text stringlengths 3 1.68M | id stringlengths 13 169 | metadata dict | __index_level_0__ int64 0 2.21k |
|---|---|---|---|
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/src/transformers/models/wavlm/convert_wavlm_original_pytorch_checkpoint_to_pytorch.py/0 | {
"file_path": "transformers/src/transformers/models/wavlm/convert_wavlm_original_pytorch_checkpoint_to_pytorch.py",
"repo_id": "transformers",
"token_count": 3804
} | 769 |
<jupyter_start><jupyter_text>Building a Router from ScratchIn this tutorial, we show you how to build an LLM-powered router module that can route a user query to submodules.Routers are a simple but effective form of automated decision making that can allow you to perform dynamic retrieval/querying over your data.In Lla... | llama_index/docs/examples/low_level/router.ipynb/0 | {
"file_path": "llama_index/docs/examples/low_level/router.ipynb",
"repo_id": "llama_index",
"token_count": 4389
} | 1,066 |
---
sidebar_position: 2
sidebar_class_name: hidden
---
# Conversational Retrieval QA
:::info
Looking for the older, non-LCEL version? Click [here](/docs/modules/chains/popular/chat_vector_db_legacy).
:::
A common requirement for retrieval-augmented generation chains is support for followup questions.
Followup questi... | langchainjs/docs/core_docs/docs/modules/chains/popular/chat_vector_db.mdx/0 | {
"file_path": "langchainjs/docs/core_docs/docs/modules/chains/popular/chat_vector_db.mdx",
"repo_id": "langchainjs",
"token_count": 963
} | 729 |
import { test, expect } from "@jest/globals";
import * as fs from "node:fs/promises";
import * as path from "node:path";
import * as os from "node:os";
import { OpenAIEmbeddings } from "@langchain/openai";
import { Document } from "@langchain/core/documents";
import { HNSWLib } from "../hnswlib.js";
test("Test HNSWL... | langchainjs/libs/langchain-community/src/vectorstores/tests/hnswlib.int.test.ts/0 | {
"file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/hnswlib.int.test.ts",
"repo_id": "langchainjs",
"token_count": 1179
} | 972 |
[build]
rustflags = ["-C", "target-cpu=native"]
[target.wasm32-unknown-unknown]
rustflags = ["-C", "target-feature=+simd128"]
[target.x86_64-apple-darwin]
rustflags = ["-C", "target-feature=-avx,-avx2"] | candle/.cargo/config.toml/0 | {
"file_path": "candle/.cargo/config.toml",
"repo_id": "candle",
"token_count": 84
} | 22 |
# coding=utf-8
# Copyright 2023 Google Research, Inc. and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/license... | transformers/src/transformers/models/efficientnet/configuration_efficientnet.py/0 | {
"file_path": "transformers/src/transformers/models/efficientnet/configuration_efficientnet.py",
"repo_id": "transformers",
"token_count": 3016
} | 657 |
package migration
import "github.com/milvus-io/milvus/pkg/util/typeutil"
const (
Role = "migration"
)
var Roles = []string{
typeutil.RootCoordRole,
typeutil.IndexCoordRole,
typeutil.IndexNodeRole,
typeutil.DataCoordRole,
typeutil.DataNodeRole,
typeutil.QueryCoordRole,
typeutil.QueryNodeRole,
typeutil.ProxyR... | milvus/cmd/tools/migration/migration/constant.go/0 | {
"file_path": "milvus/cmd/tools/migration/migration/constant.go",
"repo_id": "milvus",
"token_count": 128
} | 1,633 |
<script lang="ts">
import { onMount, onDestroy } from "svelte";
let el: HTMLElement;
onMount(() => {
el.ownerDocument.body.appendChild(el);
});
onDestroy(() => {
if (el?.parentNode) {
el.parentNode.removeChild(el);
}
});
</script>
<div bind:this={el} class="contents" hidden>
<slot />
</div>
| chat-ui/src/lib/components/Portal.svelte/0 | {
"file_path": "chat-ui/src/lib/components/Portal.svelte",
"repo_id": "chat-ui",
"token_count": 130
} | 92 |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/src/transformers/models/donut/processing_donut.py/0 | {
"file_path": "transformers/src/transformers/models/donut/processing_donut.py",
"repo_id": "transformers",
"token_count": 3519
} | 663 |
# neo4j_cypher
This template allows you to interact with a Neo4j graph database in natural language, using an OpenAI LLM.
It transforms a natural language question into a Cypher query (used to fetch data from Neo4j databases), executes the query, and provides a natural language response based on the query results.
... | langchain/templates/neo4j-cypher/README.md/0 | {
"file_path": "langchain/templates/neo4j-cypher/README.md",
"repo_id": "langchain",
"token_count": 1026
} | 663 |
"""Test LLM chain."""
from tempfile import TemporaryDirectory
from typing import Dict, List, Union
from unittest.mock import patch
import pytest
from langchain_core.output_parsers import BaseOutputParser
from langchain_core.prompts import PromptTemplate
from langchain.chains.llm import LLMChain
from tests.unit_tests.... | langchain/libs/langchain/tests/unit_tests/chains/test_llm.py/0 | {
"file_path": "langchain/libs/langchain/tests/unit_tests/chains/test_llm.py",
"repo_id": "langchain",
"token_count": 900
} | 635 |
from __module_name__.chat_models import Chat__ModuleName__
from __module_name__.embeddings import __ModuleName__Embeddings
from __module_name__.llms import __ModuleName__LLM
from __module_name__.vectorstores import __ModuleName__VectorStore
__all__ = [
"__ModuleName__LLM",
"Chat__ModuleName__",
"__ModuleNa... | langchain/libs/cli/langchain_cli/integration_template/integration_template/__init__.py/0 | {
"file_path": "langchain/libs/cli/langchain_cli/integration_template/integration_template/__init__.py",
"repo_id": "langchain",
"token_count": 127
} | 208 |
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js";
/* #__PURE__ */ logVersion010MigrationWarning({
oldEntrypointName: "vectorstores/prisma",
});
export * from "@langchain/community/vectorstores/prisma";
| langchainjs/langchain/src/vectorstores/prisma.ts/0 | {
"file_path": "langchainjs/langchain/src/vectorstores/prisma.ts",
"repo_id": "langchainjs",
"token_count": 72
} | 1,005 |
#include <stdio.h>
#include <assert.h>
#define MIN_VALUE (-1e38)
template <typename F>
__global__ void kernel_forward(
const int B, const int T, const int C, const F *__restrict__ const _w, const F *__restrict__ const _u,
const F *__restrict__ const _k, const F *__restrict__ const _v, F *__restrict__ const _y... | transformers/src/transformers/kernels/rwkv/wkv_cuda.cu/0 | {
"file_path": "transformers/src/transformers/kernels/rwkv/wkv_cuda.cu",
"repo_id": "transformers",
"token_count": 3131
} | 576 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | transformers/docs/source/ja/model_doc/clipseg.md/0 | {
"file_path": "transformers/docs/source/ja/model_doc/clipseg.md",
"repo_id": "transformers",
"token_count": 2201
} | 516 |
"""Composability graphs."""
from typing import Any, Dict, List, Optional, Sequence, Type, cast
from llama_index.legacy.core.base_query_engine import BaseQueryEngine
from llama_index.legacy.data_structs.data_structs import IndexStruct
from llama_index.legacy.indices.base import BaseIndex
from llama_index.legacy.schema... | llama_index/llama-index-legacy/llama_index/legacy/indices/composability/graph.py/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/composability/graph.py",
"repo_id": "llama_index",
"token_count": 2324
} | 1,597 |
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/tests/repo_utils/test_check_copies.py/0 | {
"file_path": "transformers/tests/repo_utils/test_check_copies.py",
"repo_id": "transformers",
"token_count": 7781
} | 764 |
{
"extends": "next/core-web-vitals"
}
| chat-langchain/chat-langchain/.eslintrc.json/0 | {
"file_path": "chat-langchain/chat-langchain/.eslintrc.json",
"repo_id": "chat-langchain",
"token_count": 20
} | 8 |
<jupyter_start><jupyter_text>Airbyte Salesforce >[Airbyte](https://github.com/airbytehq/airbyte) is a data integration platform for ELT pipelines from APIs, databases & files to warehouses & lakes. It has the largest catalog of ELT connectors to data warehouses and databases.This loader exposes the Salesforce connector... | langchain/docs/docs/integrations/document_loaders/airbyte_salesforce.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/document_loaders/airbyte_salesforce.ipynb",
"repo_id": "langchain",
"token_count": 1046
} | 101 |
[tool.poetry]
name = "__app_name__"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
readme = "README.md"
packages = [
{ include = "app" },
]
[tool.poetry.dependencies]
python = "^3.11"
uvicorn = "^0.23.2"
langserve = {extras = ["server"], version = ">=0.0.30"}
pydantic = "<2"
[tool.p... | langchain/libs/cli/langchain_cli/project_template/pyproject.toml/0 | {
"file_path": "langchain/libs/cli/langchain_cli/project_template/pyproject.toml",
"repo_id": "langchain",
"token_count": 199
} | 206 |
import { test, expect } from "@jest/globals";
import { Cluster } from "couchbase";
import { CouchbaseDocumentLoader } from "../web/couchbase.js";
test("Test Couchbase Cluster connection ", async () => {
const connectionString = "<enter-valid-couchbase-connection-string>";
const databaseUsername = "<enter-valid-cou... | langchainjs/langchain/src/document_loaders/tests/couchbase.int.test.ts/0 | {
"file_path": "langchainjs/langchain/src/document_loaders/tests/couchbase.int.test.ts",
"repo_id": "langchainjs",
"token_count": 401
} | 969 |
from llama_index.core.tools.tool_spec.load_and_search.base import (
LoadAndSearchToolSpec,
)
__all__ = ["LoadAndSearchToolSpec"]
| llama_index/llama-index-core/llama_index/core/tools/tool_spec/load_and_search/__init__.py/0 | {
"file_path": "llama_index/llama-index-core/llama_index/core/tools/tool_spec/load_and_search/__init__.py",
"repo_id": "llama_index",
"token_count": 49
} | 1,181 |
## chromadb
Chroma is the open-source embedding database. Chroma makes it easy to build LLM apps by making knowledge, facts, and skills pluggable for LLMs.
This package gives you a JS/TS interface to talk to a backend Chroma DB over REST.
[Learn more about Chroma](https://github.com/chroma-core/chroma)
- [💬 Commun... | chroma/clients/js/README.md/0 | {
"file_path": "chroma/clients/js/README.md",
"repo_id": "chroma",
"token_count": 476
} | 28 |
from .model import FSNERModel
from .tokenizer_utils import FSNERTokenizerUtils
__all__ = ["FSNERModel", "FSNERTokenizerUtils"]
| transformers/examples/research_projects/fsner/src/fsner/__init__.py/0 | {
"file_path": "transformers/examples/research_projects/fsner/src/fsner/__init__.py",
"repo_id": "transformers",
"token_count": 44
} | 600 |
from langchain_community.llms.human import (
HumanInputLLM,
)
__all__ = ["HumanInputLLM"]
| langchain/libs/langchain/langchain/llms/human.py/0 | {
"file_path": "langchain/libs/langchain/langchain/llms/human.py",
"repo_id": "langchain",
"token_count": 36
} | 514 |
from langchain_community.example_selectors.ngram_overlap import (
NGramOverlapExampleSelector,
ngram_overlap_score,
)
__all__ = [
"NGramOverlapExampleSelector",
"ngram_overlap_score",
]
| langchain/libs/langchain/langchain/prompts/example_selector/ngram_overlap.py/0 | {
"file_path": "langchain/libs/langchain/langchain/prompts/example_selector/ngram_overlap.py",
"repo_id": "langchain",
"token_count": 80
} | 553 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/src/transformers/models/blip_2/__init__.py/0 | {
"file_path": "transformers/src/transformers/models/blip_2/__init__.py",
"repo_id": "transformers",
"token_count": 887
} | 642 |
<jupyter_start><jupyter_text>Docugami RAG over XML Knowledge Graphs (KG-RAG)Many documents contain a mixture of content types, including text and tables. Semi-structured data can be challenging for conventional RAG for a few reasons since semantics may be lost by text-only chunking techniques, e.g.: * Text splitting ma... | langchain/cookbook/docugami_xml_kg_rag.ipynb/0 | {
"file_path": "langchain/cookbook/docugami_xml_kg_rag.ipynb",
"repo_id": "langchain",
"token_count": 7678
} | 75 |
from llama_index.core.storage.index_store.keyval_index_store import KVIndexStore
from llama_index.storage.index_store.dynamodb import DynamoDBIndexStore
def test_class():
names_of_base_classes = [b.__name__ for b in DynamoDBIndexStore.__mro__]
assert KVIndexStore.__name__ in names_of_base_classes
| llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-dynamodb/tests/test_storage_index_store_dynamodb.py/0 | {
"file_path": "llama_index/llama-index-integrations/storage/index_store/llama-index-storage-index-store-dynamodb/tests/test_storage_index_store_dynamodb.py",
"repo_id": "llama_index",
"token_count": 111
} | 1,417 |
<!--Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/usage_guides/local_sgd.md/0 | {
"file_path": "accelerate/docs/source/usage_guides/local_sgd.md",
"repo_id": "accelerate",
"token_count": 1494
} | 5 |
import * as rockset from "@rockset/client";
import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai";
import { RocksetStore } from "@langchain/community/vectorstores/rockset";
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
import { readFileSync } from "fs";
import { ChatPromptTemplate... | langchainjs/examples/src/indexes/vector_stores/rockset.ts/0 | {
"file_path": "langchainjs/examples/src/indexes/vector_stores/rockset.ts",
"repo_id": "langchainjs",
"token_count": 505
} | 809 |
use std::borrow::Borrow;
use std::collections::HashMap;
use std::hash::Hash;
use std::sync::RwLock;
/// The default capacity for a `BPE`'s internal cache.
pub static DEFAULT_CACHE_CAPACITY: usize = 10_000;
/// Provides a simple multithread cache to speed up BPE tokenization that will try to read values
/// concurrent... | tokenizers/tokenizers/src/utils/cache.rs/0 | {
"file_path": "tokenizers/tokenizers/src/utils/cache.rs",
"repo_id": "tokenizers",
"token_count": 1436
} | 441 |
from llama_index.core.readers.base import BaseReader
from llama_index.readers.firebase_realtimedb import FirebaseRealtimeDatabaseReader
def test_class():
names_of_base_classes = [b.__name__ for b in FirebaseRealtimeDatabaseReader.__mro__]
assert BaseReader.__name__ in names_of_base_classes
| llama_index/llama-index-integrations/readers/llama-index-readers-firebase-realtimedb/tests/test_readers_firebase_realtimedb.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-firebase-realtimedb/tests/test_readers_firebase_realtimedb.py",
"repo_id": "llama_index",
"token_count": 100
} | 1,299 |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/src/transformers/models/focalnet/convert_focalnet_to_hf_format.py/0 | {
"file_path": "transformers/src/transformers/models/focalnet/convert_focalnet_to_hf_format.py",
"repo_id": "transformers",
"token_count": 3999
} | 608 |
/// <reference types="vite/client" />
| langchainjs/environment_tests/test-exports-vite/src/vite-env.d.ts/0 | {
"file_path": "langchainjs/environment_tests/test-exports-vite/src/vite-env.d.ts",
"repo_id": "langchainjs",
"token_count": 12
} | 787 |
# Decoders
<tokenizerslangcontent>
<python>
## BPEDecoder
[[autodoc]] tokenizers.decoders.BPEDecoder
## ByteLevel
[[autodoc]] tokenizers.decoders.ByteLevel
## CTC
[[autodoc]] tokenizers.decoders.CTC
## Metaspace
[[autodoc]] tokenizers.decoders.Metaspace
## WordPiece
[[autodoc]] tokenizers.decoders.WordPiece
<... | tokenizers/docs/source-doc-builder/api/decoders.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/api/decoders.mdx",
"repo_id": "tokenizers",
"token_count": 197
} | 469 |
<jupyter_start><jupyter_text>Corrective RAG PackThis notebook walks through using the `CorrectiveRAGPack` based on the paper [Corrective Retrieval Augmented Generation](https://arxiv.org/abs/2401.15884).A brief understanding of the paper:Corrective Retrieval Augmented Generation (CRAG) is a method designed to enhance t... | llama_index/llama-index-packs/llama-index-packs-corrective-rag/examples/corrective_rag.ipynb/0 | {
"file_path": "llama_index/llama-index-packs/llama-index-packs-corrective-rag/examples/corrective_rag.ipynb",
"repo_id": "llama_index",
"token_count": 657
} | 1,649 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | accelerate/docs/source/concept_guides/deferring_execution.md/0 | {
"file_path": "accelerate/docs/source/concept_guides/deferring_execution.md",
"repo_id": "accelerate",
"token_count": 1350
} | 2 |
# coding=utf-8
# Copyright 2021 The Google Flax Team Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | transformers/src/transformers/models/big_bird/modeling_flax_big_bird.py/0 | {
"file_path": "transformers/src/transformers/models/big_bird/modeling_flax_big_bird.py",
"repo_id": "transformers",
"token_count": 50764
} | 649 |
from __future__ import annotations
import asyncio
import copy
import threading
from collections import defaultdict
from typing import (
Any,
AsyncIterator,
Dict,
List,
Literal,
Optional,
Sequence,
TypeVar,
Union,
overload,
)
from uuid import UUID
import jsonpatch # type: ignor... | langchain/libs/core/langchain_core/tracers/log_stream.py/0 | {
"file_path": "langchain/libs/core/langchain_core/tracers/log_stream.py",
"repo_id": "langchain",
"token_count": 9609
} | 398 |
// If you want to import the browser version, use the following line instead:
// import { CloseVectorWeb } from "@langchain/community/vectorstores/closevector/web";
import { CloseVectorNode } from "@langchain/community/vectorstores/closevector/node";
import { OpenAIEmbeddings } from "@langchain/openai";
// Create a ve... | langchainjs/examples/src/indexes/vector_stores/closevector_saveload.ts/0 | {
"file_path": "langchainjs/examples/src/indexes/vector_stores/closevector_saveload.ts",
"repo_id": "langchainjs",
"token_count": 329
} | 814 |
// T5 Text Model, quantized version
// https://github.com/huggingface/transformers/blob/main/src/transformers/models/t5/modeling_t5.py
use crate::models::t5::{deserialize_feed_forward_proj_activation, ActivationWithOptionalGating};
use crate::models::with_tracing::QMatMul;
use crate::quantized_nn::Embedding;
pub use c... | candle/candle-transformers/src/models/quantized_t5.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_t5.rs",
"repo_id": "candle",
"token_count": 13996
} | 69 |
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: Milvus Segcore
Description: Segcore modules for Milvus
Version: @MILVUS_VERSION@
Libs: -L${libdir} -lmilvus_segcore
Cflags: -I${includedir}
| milvus/internal/core/src/segcore/milvus_segcore.pc.in/0 | {
"file_path": "milvus/internal/core/src/segcore/milvus_segcore.pc.in",
"repo_id": "milvus",
"token_count": 100
} | 1,885 |
"""Test TencentVectorDB functionality."""
import time
from typing import List, Optional
from langchain_core.documents import Document
from langchain_community.vectorstores import TencentVectorDB
from langchain_community.vectorstores.tencentvectordb import ConnectionParams
from tests.integration_tests.vectorstores.fak... | langchain/libs/community/tests/integration_tests/vectorstores/test_tencentvectordb.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_tencentvectordb.py",
"repo_id": "langchain",
"token_count": 1215
} | 358 |
<!--Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | transformers/docs/source/ja/transformers_agents.md/0 | {
"file_path": "transformers/docs/source/ja/transformers_agents.md",
"repo_id": "transformers",
"token_count": 7879
} | 555 |
accuracy:
collections:
-
server:
db_config.primary_path: /test/milvus/db_data_7/sift_1m_256_128_l2_sq8
cache_config.cpu_cache_capacity: 16
engine_config.use_blas_threshold: 1100
engine_config.gpu_search_threshold: 1
gpu_resource_config.enable: true
gpu_resourc... | milvus/tests/benchmark/milvus_benchmark/suites/gpu_accuracy_sift1m.yaml/0 | {
"file_path": "milvus/tests/benchmark/milvus_benchmark/suites/gpu_accuracy_sift1m.yaml",
"repo_id": "milvus",
"token_count": 349
} | 1,943 |
"""For backwards compatibility."""
from langchain_community.utilities.serpapi import SerpAPIWrapper
__all__ = ["SerpAPIWrapper"]
| langchain/libs/langchain/langchain/serpapi.py/0 | {
"file_path": "langchain/libs/langchain/langchain/serpapi.py",
"repo_id": "langchain",
"token_count": 39
} | 544 |
import os
from functools import lru_cache
import httpx
import boto3
from langchain_community.chat_models import BedrockChat, ChatAnthropic, ChatFireworks
from langchain_google_vertexai import ChatVertexAI
from langchain_openai import AzureChatOpenAI, ChatOpenAI
@lru_cache(maxsize=4)
def get_openai_llm(gpt_4: bool = F... | opengpts/backend/app/llms.py/0 | {
"file_path": "opengpts/backend/app/llms.py",
"repo_id": "opengpts",
"token_count": 1091
} | 1,994 |
import { OpenAI } from "@langchain/openai";
import { SqlDatabase } from "langchain/sql_db";
import { createSqlAgent, SqlToolkit } from "langchain/agents/toolkits/sql";
import { DataSource } from "typeorm";
/**
* This example uses a SAP HANA Cloud database. You can create a free trial database via https://developers.s... | langchainjs/examples/src/agents/sql_sap_hana.ts/0 | {
"file_path": "langchainjs/examples/src/agents/sql_sap_hana.ts",
"repo_id": "langchainjs",
"token_count": 978
} | 782 |
<jupyter_start><jupyter_text>SitemapExtends from the `WebBaseLoader`, `SitemapLoader` loads a sitemap from a given URL, and then scrape and load all pages in the sitemap, returning each page as a Document.The scraping is done concurrently. There are reasonable limits to concurrent requests, defaulting to 2 per second.... | langchain/docs/docs/integrations/document_loaders/sitemap.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/document_loaders/sitemap.ipynb",
"repo_id": "langchain",
"token_count": 1063
} | 114 |
import { PromptTemplate } from "@langchain/core/prompts";
const refinePromptTemplate = `Your job is to produce a final summary
We have provided an existing summary up to a certain point: "{existing_answer}"
We have the opportunity to refine the existing summary
(only if needed) with some more context below.
----------... | langchainjs/langchain/src/chains/summarization/refine_prompts.ts/0 | {
"file_path": "langchainjs/langchain/src/chains/summarization/refine_prompts.ts",
"repo_id": "langchainjs",
"token_count": 165
} | 910 |
import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai";
import { AIMessage, HumanMessage } from "@langchain/core/messages";
import { MemoryVectorStore } from "../../../vectorstores/memory.js";
import { ViolationOfExpectationsChain } from "../violation_of_expectations/violation_of_expectations_chain.js";
cons... | langchainjs/langchain/src/experimental/chains/tests/violation_of_expectations_chain.int.test.ts/0 | {
"file_path": "langchainjs/langchain/src/experimental/chains/tests/violation_of_expectations_chain.int.test.ts",
"repo_id": "langchainjs",
"token_count": 414
} | 908 |
<!--Copyright 2021 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | transformers/docs/source/en/model_doc/roformer.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/roformer.md",
"repo_id": "transformers",
"token_count": 1450
} | 515 |
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from llama_index.postprocessor.cohere_rerank import CohereRerank
def test_class():
names_of_base_classes = [b.__name__ for b in CohereRerank.__mro__]
assert BaseNodePostprocessor.__name__ in names_of_base_classes
| llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-cohere-rerank/tests/test_postprocessor_cohere_rerank.py/0 | {
"file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-cohere-rerank/tests/test_postprocessor_cohere_rerank.py",
"repo_id": "llama_index",
"token_count": 99
} | 1,435 |
python_sources()
| llama_index/llama-index-integrations/embeddings/llama-index-embeddings-instructor/llama_index/embeddings/instructor/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-instructor/llama_index/embeddings/instructor/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,199 |
"""**LangSmith** utilities.
This module provides utilities for connecting to `LangSmith <https://smith.langchain.com/>`_. For more information on LangSmith, see the `LangSmith documentation <https://docs.smith.langchain.com/>`_.
**Evaluation**
LangSmith helps you evaluate Chains and other language model application ... | langchain/libs/langchain/langchain/smith/__init__.py/0 | {
"file_path": "langchain/libs/langchain/langchain/smith/__init__.py",
"repo_id": "langchain",
"token_count": 1365
} | 592 |
"""Test OCI Generative AI LLM service"""
from unittest.mock import MagicMock
import pytest
from pytest import MonkeyPatch
from langchain_community.llms import OCIGenAI
class MockResponseDict(dict):
def __getattr__(self, val): # type: ignore[no-untyped-def]
return self[val]
@pytest.mark.requires("oci"... | langchain/libs/community/tests/unit_tests/llms/test_oci_generative_ai.py/0 | {
"file_path": "langchain/libs/community/tests/unit_tests/llms/test_oci_generative_ai.py",
"repo_id": "langchain",
"token_count": 1672
} | 399 |
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use th... | milvus/internal/core/src/common/IndexMeta.cpp/0 | {
"file_path": "milvus/internal/core/src/common/IndexMeta.cpp",
"repo_id": "milvus",
"token_count": 1205
} | 1,731 |
<!--Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | transformers/docs/source/ko/tasks/monocular_depth_estimation.md/0 | {
"file_path": "transformers/docs/source/ko/tasks/monocular_depth_estimation.md",
"repo_id": "transformers",
"token_count": 3120
} | 532 |
import { Document } from "@langchain/core/documents";
import { CheerioWebBaseLoader } from "./cheerio.js";
/**
* A class that extends the CheerioWebBaseLoader class. It represents a
* loader for loading web pages from the IMSDB (Internet Movie Script
* Database) website.
*/
export class IMSDBLoader extends Cheerio... | langchainjs/langchain/src/document_loaders/web/imsdb.ts/0 | {
"file_path": "langchainjs/langchain/src/document_loaders/web/imsdb.ts",
"repo_id": "langchainjs",
"token_count": 321
} | 926 |
from langchain_community.tools.plugin import (
AIPlugin,
AIPluginTool,
AIPluginToolSchema,
ApiConfig,
)
__all__ = [
"ApiConfig",
"AIPlugin",
"AIPluginToolSchema",
"AIPluginTool",
]
| langchain/libs/langchain/langchain/tools/plugin.py/0 | {
"file_path": "langchain/libs/langchain/langchain/tools/plugin.py",
"repo_id": "langchain",
"token_count": 93
} | 558 |
package indexparamcheck
import (
"strconv"
"testing"
"github.com/stretchr/testify/assert"
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
"github.com/milvus-io/milvus/pkg/util/metric"
)
func Test_raftIvfFlatChecker_CheckTrain(t *testing.T) {
validParams := map[string]string{
DIM: strconv.Itoa(128)... | milvus/pkg/util/indexparamcheck/raft_ivf_flat_checker_test.go/0 | {
"file_path": "milvus/pkg/util/indexparamcheck/raft_ivf_flat_checker_test.go",
"repo_id": "milvus",
"token_count": 1455
} | 1,841 |
# rag-elasticsearch
This template performs RAG using [ElasticSearch](https://python.langchain.com/docs/integrations/vectorstores/elasticsearch).
It relies on sentence transformer `MiniLM-L6-v2` for embedding passages and questions.
## Environment Setup
Set the `OPENAI_API_KEY` environment variable to access the Op... | langchain/templates/rag-elasticsearch/README.md/0 | {
"file_path": "langchain/templates/rag-elasticsearch/README.md",
"repo_id": "langchain",
"token_count": 893
} | 729 |
# coding=utf-8
# Copyright 2022 SenseTime and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | transformers/src/transformers/models/deta/configuration_deta.py/0 | {
"file_path": "transformers/src/transformers/models/deta/configuration_deta.py",
"repo_id": "transformers",
"token_count": 5369
} | 604 |
import { test, expect } from "@jest/globals";
import { OutputParserException } from "@langchain/core/output_parsers";
import { DatetimeOutputParser } from "../datetime.js";
test("DatetimeOutputParser", async () => {
const parser = new DatetimeOutputParser();
const currentDate = new Date();
const currentDateStr ... | langchainjs/langchain/src/output_parsers/tests/datetime.test.ts/0 | {
"file_path": "langchainjs/langchain/src/output_parsers/tests/datetime.test.ts",
"repo_id": "langchainjs",
"token_count": 234
} | 924 |
//load Candle Bert Module wasm module
let init, ModelConditionalGeneration;
async function fetchArrayBuffer(url) {
const cacheName = "t5-candle-cache";
const cache = await caches.open(cacheName);
const cachedResponse = await cache.match(url);
if (cachedResponse) {
const data = await cachedResponse.arrayBuf... | candle/candle-wasm-examples/t5/T5ModelConditionalGeneration.js/0 | {
"file_path": "candle/candle-wasm-examples/t5/T5ModelConditionalGeneration.js",
"repo_id": "candle",
"token_count": 980
} | 83 |
from typing import Optional, Tuple, Union
import torch
import torch.nn as nn
class PatchDropout(nn.Module):
"""
https://arxiv.org/abs/2212.00794
"""
return_indices: torch.jit.Final[bool]
def __init__(
self,
prob: float = 0.5,
num_prefix_tokens: int = 1,
... | pytorch-image-models/timm/layers/patch_dropout.py/0 | {
"file_path": "pytorch-image-models/timm/layers/patch_dropout.py",
"repo_id": "pytorch-image-models",
"token_count": 842
} | 356 |
# coding=utf-8
# Copyright 2020 The Trax Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/src/transformers/models/reformer/tokenization_reformer.py/0 | {
"file_path": "transformers/src/transformers/models/reformer/tokenization_reformer.py",
"repo_id": "transformers",
"token_count": 3018
} | 732 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | transformers/docs/source/zh/pipeline_tutorial.md/0 | {
"file_path": "transformers/docs/source/zh/pipeline_tutorial.md",
"repo_id": "transformers",
"token_count": 7441
} | 564 |
import re
import torch
import torch.distributed
from typing import List, Optional, Type
from transformers import (
AutoTokenizer,
AutoConfig,
PreTrainedTokenizerBase,
)
from text_generation_server.models import CausalLM
from text_generation_server.models.causal_lm import CausalLMBatch
from text_generation... | text-generation-inference/server/text_generation_server/models/galactica.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/galactica.py",
"repo_id": "text-generation-inference",
"token_count": 3726
} | 430 |
import os
from typing import List, Optional
from llama_index_client import (
ConfigurableDataSourceNames,
ConfigurableTransformationNames,
ConfiguredTransformationItem,
DataSourceCreate,
PipelineCreate,
PipelineType,
ProjectCreate,
)
from llama_index_client.client import AsyncPlatformApi, P... | llama_index/llama-index-core/llama_index/core/ingestion/api_utils.py/0 | {
"file_path": "llama_index/llama-index-core/llama_index/core/ingestion/api_utils.py",
"repo_id": "llama_index",
"token_count": 2092
} | 1,271 |
import {
CallbackManagerForChainRun,
Callbacks,
} from "@langchain/core/callbacks/manager";
import { ChainValues } from "@langchain/core/utils/types";
import { ChainInputs, BaseChain } from "./base.js";
/**
* Interface that extends the `ChainInputs` interface and defines the
* fields required for a transform cha... | langchainjs/langchain/src/chains/transform.ts/0 | {
"file_path": "langchainjs/langchain/src/chains/transform.ts",
"repo_id": "langchainjs",
"token_count": 650
} | 913 |
poetry_requirements(
name="poetry",
)
| llama_index/llama-index-integrations/callbacks/llama-index-callbacks-aim/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-aim/BUILD",
"repo_id": "llama_index",
"token_count": 18
} | 1,206 |
poetry_requirements(
name="poetry",
)
python_requirements(
name="reqs",
)
| llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-cdk/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-cdk/BUILD",
"repo_id": "llama_index",
"token_count": 36
} | 1,398 |
// Copyright 2023 yah01
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writin... | milvus/internal/querynodev2/segments/segment_l0.go/0 | {
"file_path": "milvus/internal/querynodev2/segments/segment_l0.go",
"repo_id": "milvus",
"token_count": 1540
} | 1,877 |
package tasks
import (
"context"
"math/rand"
"time"
"github.com/milvus-io/milvus/pkg/util/timerecord"
)
var (
_ Task = &MockTask{}
_ MergeTask = &MockTask{}
)
type mockTaskConfig struct {
ctx context.Context
mergeAble bool
nq int64
username string
executeCost time.Duration
exe... | milvus/internal/querynodev2/tasks/mock_task_test.go/0 | {
"file_path": "milvus/internal/querynodev2/tasks/mock_task_test.go",
"repo_id": "milvus",
"token_count": 962
} | 1,915 |
from llama_index.graph_stores.neo4j.base import Neo4jGraphStore
__all__ = ["Neo4jGraphStore"]
| llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-neo4j/llama_index/graph_stores/neo4j/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-neo4j/llama_index/graph_stores/neo4j/__init__.py",
"repo_id": "llama_index",
"token_count": 37
} | 1,268 |
# Copyright 2024 Katherine Crowson, The HuggingFace Team and hlky. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | diffusers/src/diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py",
"repo_id": "diffusers",
"token_count": 9704
} | 240 |
const { readFile, writeFile } = require("fs/promises");
async function main() {
const css = `\n.tsd-navigation {
word-break: break-word;
}
.col-content {
min-width: fit-content;
}
.page-menu {
display: none;
}
.deprecation-warning {
background-color: #ef4444;
border-radius: 0.375rem;
display: fl... | langchainjs/docs/api_refs/scripts/update-typedoc-css.js/0 | {
"file_path": "langchainjs/docs/api_refs/scripts/update-typedoc-css.js",
"repo_id": "langchainjs",
"token_count": 212
} | 721 |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/src/transformers/models/pop2piano/__init__.py/0 | {
"file_path": "transformers/src/transformers/models/pop2piano/__init__.py",
"repo_id": "transformers",
"token_count": 1512
} | 646 |
"""Integration test for Arxiv API Wrapper."""
from typing import Any, List
import pytest
from langchain_core.documents import Document
from langchain_core.tools import BaseTool
from langchain_community.tools import ArxivQueryRun
from langchain_community.utilities import ArxivAPIWrapper
@pytest.fixture
def api_clie... | langchain/libs/community/tests/integration_tests/utilities/test_arxiv.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/utilities/test_arxiv.py",
"repo_id": "langchain",
"token_count": 2146
} | 368 |
poetry_requirements(
name="poetry",
)
| llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/BUILD",
"repo_id": "llama_index",
"token_count": 18
} | 1,332 |
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use th... | milvus/pkg/mq/msgstream/factory_test.go/0 | {
"file_path": "milvus/pkg/mq/msgstream/factory_test.go",
"repo_id": "milvus",
"token_count": 956
} | 1,813 |
from __future__ import annotations
import re
from typing import Dict, Optional
from langchain_core.output_parsers import BaseOutputParser
class RegexDictParser(BaseOutputParser):
"""Parse the output of an LLM call into a Dictionary using a regex."""
regex_pattern: str = r"{}:\s?([^.'\n']*)\.?" # : :meta p... | langchain/libs/langchain/langchain/output_parsers/regex_dict.py/0 | {
"file_path": "langchain/libs/langchain/langchain/output_parsers/regex_dict.py",
"repo_id": "langchain",
"token_count": 767
} | 575 |
""" Jaguar Vector Store.
. A distributed vector database
. The ZeroMove feature enables instant horizontal scalability
. Multimodal: embeddings, text, images, videos, PDFs, audio, time series, and geospatial
. All-masters: allows both parallel reads and writes
. Anomaly detection capabilities: anomaly and anomamous
. ... | llama_index/llama-index-legacy/llama_index/legacy/vector_stores/jaguar.py/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/vector_stores/jaguar.py",
"repo_id": "llama_index",
"token_count": 7877
} | 1,724 |
""" 'Fast' Normalization Functions
For GroupNorm and LayerNorm these functions bypass typical AMP upcast to float32.
Additionally, for LayerNorm, the APEX fused LN is used if available (which also does not upcast)
Hacked together by / Copyright 2022 Ross Wightman
"""
from typing import List, Optional
import torch
f... | pytorch-image-models/timm/layers/fast_norm.py/0 | {
"file_path": "pytorch-image-models/timm/layers/fast_norm.py",
"repo_id": "pytorch-image-models",
"token_count": 1639
} | 392 |
from pathlib import Path
from typing import List
import numpy as np
import pytest
from langchain_core.documents import Document
from langchain_community.vectorstores.docarray import DocArrayHnswSearch
from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings
@pytest.fixture
def texts() -> List... | langchain/libs/community/tests/integration_tests/vectorstores/docarray/test_hnsw.py/0 | {
"file_path": "langchain/libs/community/tests/integration_tests/vectorstores/docarray/test_hnsw.py",
"repo_id": "langchain",
"token_count": 1992
} | 349 |
from __future__ import annotations
from langchain_core.language_models import LanguageModelLike
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import BasePromptTemplate
from langchain_core.retrievers import RetrieverLike, RetrieverOutputLike
from langchain_core.runnables import R... | langchain/libs/langchain/langchain/chains/history_aware_retriever.py/0 | {
"file_path": "langchain/libs/langchain/langchain/chains/history_aware_retriever.py",
"repo_id": "langchain",
"token_count": 989
} | 459 |
# coding=utf-8
# Copyright 2022 HuggingFace Inc. team and BigScience workshop.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | text-generation-inference/server/text_generation_server/models/custom_modeling/bloom_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/bloom_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 16160
} | 383 |
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | transformers/src/transformers/quantizers/quantizer_bnb_8bit.py/0 | {
"file_path": "transformers/src/transformers/quantizers/quantizer_bnb_8bit.py",
"repo_id": "transformers",
"token_count": 5200
} | 703 |
import sys
from typing import Callable
import pytest
from langchain_core.runnables.utils import (
get_lambda_source,
indent_lines_after_first,
)
@pytest.mark.skipif(
sys.version_info < (3, 9), reason="Requires python version >= 3.9 to run."
)
@pytest.mark.parametrize(
"func, expected_source",
[
... | langchain/libs/core/tests/unit_tests/runnables/test_utils.py/0 | {
"file_path": "langchain/libs/core/tests/unit_tests/runnables/test_utils.py",
"repo_id": "langchain",
"token_count": 462
} | 431 |
from langchain import memory
from tests.unit_tests import assert_all_importable
EXPECTED_ALL = [
"AstraDBChatMessageHistory",
"CassandraChatMessageHistory",
"ChatMessageHistory",
"CombinedMemory",
"ConversationBufferMemory",
"ConversationBufferWindowMemory",
"ConversationEntityMemory",
... | langchain/libs/langchain/tests/unit_tests/memory/test_imports.py/0 | {
"file_path": "langchain/libs/langchain/tests/unit_tests/memory/test_imports.py",
"repo_id": "langchain",
"token_count": 466
} | 633 |
use crate::arc_rwlock_serde;
use serde::{Deserialize, Serialize};
extern crate tokenizers as tk;
use napi::bindgen_prelude::*;
use napi_derive::napi;
use std::sync::{Arc, RwLock};
use tk::processors::PostProcessorWrapper;
use tk::Encoding;
#[derive(Clone, Serialize, Deserialize)]
#[napi]
pub struct Processor {
#[se... | tokenizers/bindings/node/src/processors.rs/0 | {
"file_path": "tokenizers/bindings/node/src/processors.rs",
"repo_id": "tokenizers",
"token_count": 1336
} | 399 |
# Builder classes
## Builders
🤗 Datasets relies on two main classes during the dataset building process: [`DatasetBuilder`] and [`BuilderConfig`].
[[autodoc]] datasets.DatasetBuilder
[[autodoc]] datasets.GeneratorBasedBuilder
[[autodoc]] datasets.BeamBasedBuilder
[[autodoc]] datasets.ArrowBasedBuilder
[[autodoc... | datasets/docs/source/package_reference/builder_classes.mdx/0 | {
"file_path": "datasets/docs/source/package_reference/builder_classes.mdx",
"repo_id": "datasets",
"token_count": 253
} | 133 |
import { OpenAI } from "@langchain/openai";
import { loadQAStuffChain, loadQAMapReduceChain } from "langchain/chains";
import { Document } from "@langchain/core/documents";
// This first example uses the `StuffDocumentsChain`.
const llmA = new OpenAI({});
const chainA = loadQAStuffChain(llmA);
const docs = [
new Doc... | langchainjs/examples/src/chains/question_answering.ts/0 | {
"file_path": "langchainjs/examples/src/chains/question_answering.ts",
"repo_id": "langchainjs",
"token_count": 315
} | 767 |
<jupyter_start><jupyter_text>Chat Over Documents with Vectara SetupYou will need a Vectara account to use Vectara with LangChain. To get started, use the following steps:1. [Sign up](https://www.vectara.com/integrations/langchain) for a Vectara account if you don't already have one. Once you have completed your sign u... | langchain/docs/docs/integrations/providers/vectara/vectara_chat.ipynb/0 | {
"file_path": "langchain/docs/docs/integrations/providers/vectara/vectara_chat.ipynb",
"repo_id": "langchain",
"token_count": 2914
} | 156 |
from astradb_entomology_rag import chain
if __name__ == "__main__":
response = chain.invoke("Are there more coleoptera or bugs?")
print(response) # noqa: T201
| langchain/templates/rag-astradb/main.py/0 | {
"file_path": "langchain/templates/rag-astradb/main.py",
"repo_id": "langchain",
"token_count": 62
} | 680 |
<!---
Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ... | transformers/docs/source/ja/perf_hardware.md/0 | {
"file_path": "transformers/docs/source/ja/perf_hardware.md",
"repo_id": "transformers",
"token_count": 4131
} | 550 |
import { AmazonKendraRetriever } from "@langchain/community/retrievers/amazon_kendra";
const retriever = new AmazonKendraRetriever({
topK: 10,
indexId: "YOUR_INDEX_ID",
region: "us-east-2", // Your region
clientOptions: {
credentials: {
accessKeyId: "YOUR_ACCESS_KEY_ID",
secretAccessKey: "YOUR_... | langchainjs/examples/src/retrievers/kendra.ts/0 | {
"file_path": "langchainjs/examples/src/retrievers/kendra.ts",
"repo_id": "langchainjs",
"token_count": 169
} | 883 |
from llama_index.core.node_parser.file.json import JSONNodeParser
from llama_index.core.schema import Document
def test_split_empty_text() -> None:
json_splitter = JSONNodeParser()
input_text = Document(text="")
result = json_splitter.get_nodes_from_documents([input_text])
assert result == []
def te... | llama_index/llama-index-core/tests/node_parser/test_json.py/0 | {
"file_path": "llama_index/llama-index-core/tests/node_parser/test_json.py",
"repo_id": "llama_index",
"token_count": 561
} | 1,269 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.