text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
python_tests()
llama_index/llama-index-integrations/llms/llama-index-llms-predibase/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-predibase/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,243
<jupyter_start><jupyter_text>CohereThis notebook demonstrates how to use Cohere Embeddings with Chroma.If you have not already, [create a Cohere account](https://dashboard.cohere.ai/welcome/register) and get your API Key.First a basic example:<jupyter_code>! pip install chromadb --quiet ! pip install cohere --quiet imp...
chroma/examples/use_with/cohere/cohere_python.ipynb/0
{ "file_path": "chroma/examples/use_with/cohere/cohere_python.ipynb", "repo_id": "chroma", "token_count": 910 }
40
<jupyter_start><jupyter_text>SQL Database::: {.callout-note}The `SQLDatabase` adapter utility is a wrapper around a database connection.For talking to SQL databases, it uses the [SQLAlchemy] Core API .:::This notebook shows how to use the utility to access an SQLite database.It uses the example [Chinook Database], and ...
langchain/docs/docs/integrations/tools/sql_database.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/sql_database.ipynb", "repo_id": "langchain", "token_count": 1712 }
177
import { GithubRepoLoader } from "langchain/document_loaders/web/github"; export const run = async () => { const loader = new GithubRepoLoader( "https://github.your.company/org/repo-name", { baseUrl: "https://github.your.company", apiUrl: "https://github.your.company/api/v3", accessToken: "...
langchainjs/examples/src/document_loaders/github_custom_instance.ts/0
{ "file_path": "langchainjs/examples/src/document_loaders/github_custom_instance.ts", "repo_id": "langchainjs", "token_count": 203 }
798
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-preprocess/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-preprocess/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,540
from langchain_community.document_loaders.helpers import ( FileEncoding, detect_file_encodings, ) __all__ = ["FileEncoding", "detect_file_encodings"]
langchain/libs/langchain/langchain/document_loaders/helpers.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/helpers.py", "repo_id": "langchain", "token_count": 59 }
491
from llama_index.readers.minio.boto3_client.base import BotoMinioReader from llama_index.readers.minio.minio_client.base import MinioReader __all__ = ["BotoMinioReader", "MinioReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/__init__.py", "repo_id": "llama_index", "token_count": 67 }
1,522
import { test, jest, expect } from "@jest/globals"; import { BaseMessage, ChatMessage, HumanMessage, SystemMessage, } from "@langchain/core/messages"; import { ChatGeneration, LLMResult } from "@langchain/core/outputs"; import { ChatPromptValue } from "@langchain/core/prompt_values"; import { PromptTemplate, ...
langchainjs/libs/langchain-openai/src/tests/chat_models.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-openai/src/tests/chat_models.int.test.ts", "repo_id": "langchainjs", "token_count": 8387 }
1,039
"""Test RDF/ SPARQL Graph Database Chain.""" import os from langchain_community.graphs import RdfGraph from langchain_community.llms.openai import OpenAI from langchain.chains.graph_qa.sparql import GraphSparqlQAChain def test_connect_file_rdf() -> None: """ Test loading online resource. """ berners...
langchain/libs/langchain/tests/integration_tests/chains/test_graph_database_sparql.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/chains/test_graph_database_sparql.py", "repo_id": "langchain", "token_count": 934 }
590
"""Test summary index.""" from typing import List from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.indices.list.base import ListRetrieverMode, SummaryIndex from llama_index.core.schema import Document from llama_index.core.service_context import ServiceContext def test_build_list...
llama_index/llama-index-core/tests/indices/list/test_index.py/0
{ "file_path": "llama_index/llama-index-core/tests/indices/list/test_index.py", "repo_id": "llama_index", "token_count": 2364 }
1,220
import { Table } from "vectordb"; import type { EmbeddingsInterface } from "@langchain/core/embeddings"; import { VectorStore } from "@langchain/core/vectorstores"; import { Document } from "@langchain/core/documents"; /** * Defines the arguments for the LanceDB class constructor. It includes a * table and an option...
langchainjs/libs/langchain-community/src/vectorstores/lancedb.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/lancedb.ts", "repo_id": "langchainjs", "token_count": 1643 }
1,048
from langchain_community.tools.reddit_search.tool import ( RedditSearchRun, RedditSearchSchema, ) __all__ = ["RedditSearchSchema", "RedditSearchRun"]
langchain/libs/langchain/langchain/tools/reddit_search/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/reddit_search/tool.py", "repo_id": "langchain", "token_count": 52 }
555
"""Chain that implements the ReAct paper from https://arxiv.org/pdf/2210.03629.pdf.""" from typing import Any, List, Optional, Sequence from langchain_core._api import deprecated from langchain_core.documents import Document from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts impor...
langchain/libs/langchain/langchain/agents/react/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/react/base.py", "repo_id": "langchain", "token_count": 2318 }
477
import json import hashlib class Server: """ { "_version": "0.1", "_type": "server", "version": string, "build_commit": string, # "md5": string, } """ def __init__(self, version=None, mode=None, build_commit=None, deploy_opology=None): self._version...
milvus/tests/benchmark/milvus_benchmark/metrics/models/server.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/metrics/models/server.py", "repo_id": "milvus", "token_count": 319 }
1,959
# SSL ResNet **Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residual b...
pytorch-image-models/docs/models/ssl-resnet.md/0
{ "file_path": "pytorch-image-models/docs/models/ssl-resnet.md", "repo_id": "pytorch-image-models", "token_count": 2422 }
357
import ast import re from typing import ( Any, Dict, Iterator, List, Optional, Sequence, Tuple, Union, ) from langchain_core.exceptions import OutputParserException from langchain_core.messages import BaseMessage from langchain_core.output_parsers.transform import BaseTransformOutputPar...
langgraph/examples/llm-compiler/output_parser.py/0
{ "file_path": "langgraph/examples/llm-compiler/output_parser.py", "repo_id": "langgraph", "token_count": 2403 }
1,030
<jupyter_start><jupyter_text>Press Releases Data=Press Releases data powered by [Kay.ai](https://kay.ai).>Press releases are used by companies to announce something noteworthy, including product launches, financial performance reports, partnerships, and other significant news. They are widely used by analysts to track ...
langchain/cookbook/press_releases.ipynb/0
{ "file_path": "langchain/cookbook/press_releases.ipynb", "repo_id": "langchain", "token_count": 853 }
80
from langchain_community.chat_models.yandex import ( ChatYandexGPT, ) __all__ = ["ChatYandexGPT"]
langchain/libs/langchain/langchain/chat_models/yandex.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/yandex.py", "repo_id": "langchain", "token_count": 43 }
482
<!--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 applicable law or agreed...
transformers/docs/source/pt/serialization.md/0
{ "file_path": "transformers/docs/source/pt/serialization.md", "repo_id": "transformers", "token_count": 7096 }
560
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-text-embeddings-inference/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-text-embeddings-inference/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,196
from langchain_community.tools.file_management.move import FileMoveInput, MoveFileTool __all__ = ["FileMoveInput", "MoveFileTool"]
langchain/libs/langchain/langchain/tools/file_management/move.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/file_management/move.py", "repo_id": "langchain", "token_count": 38 }
548
from typing import Dict, Tuple, Union from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, Visitor, ) class ElasticsearchTranslator(Visitor): """Translate `Elasticsearch` internal query language elements to valid filters.""" ...
langchain/libs/langchain/langchain/retrievers/self_query/elasticsearch.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/self_query/elasticsearch.py", "repo_id": "langchain", "token_count": 1477 }
584
<jupyter_start><jupyter_text>Multi-Tenancy RAG with LlamaIndexIn this notebook you will look into building Multi-Tenancy RAG System using LlamaIndex.1. Setup2. Download Data3. Load Data4. Create Index5. Create Ingestion Pipeline6. Update Metadata and Insert documents7. Define Query Engines for each user8. Querying Set...
llama_index/docs/examples/multi_tenancy/multi_tenancy_rag.ipynb/0
{ "file_path": "llama_index/docs/examples/multi_tenancy/multi_tenancy_rag.ipynb", "repo_id": "llama_index", "token_count": 1879 }
1,121
python_sources()
llama_index/llama-index-integrations/agent/llama-index-agent-openai-legacy/llama_index/agent/openai_legacy/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/agent/llama-index-agent-openai-legacy/llama_index/agent/openai_legacy/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,165
from langchain_community.document_loaders.baiducloud_bos_directory import ( BaiduBOSDirectoryLoader, ) __all__ = ["BaiduBOSDirectoryLoader"]
langchain/libs/langchain/langchain/document_loaders/baiducloud_bos_directory.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/baiducloud_bos_directory.py", "repo_id": "langchain", "token_count": 51 }
502
{ "participants": [{"name": "User 1"}, {"name": "User 2"}], "messages": [ {"sender_name": "User 2", "timestamp_ms": 1675597571851, "content": "Bye!"}, { "sender_name": "User 1", "timestamp_ms": 1675597435669, "content": "Oh no worries! Bye" }, ...
langchain/libs/langchain/tests/integration_tests/examples/facebook_chat.json/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/examples/facebook_chat.json", "repo_id": "langchain", "token_count": 1150 }
639
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-smart-pdf-loader/llama_index/readers/smart_pdf_loader/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-smart-pdf-loader/llama_index/readers/smart_pdf_loader/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,457
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "llms/yandex", newEntrypointName: "", newPackageName: "@langchain/yandex", }); export * from "@langchain/community/llms/yandex";
langchainjs/langchain/src/llms/yandex.ts/0
{ "file_path": "langchainjs/langchain/src/llms/yandex.ts", "repo_id": "langchainjs", "token_count": 97 }
968
from chain_of_note_wiki.chain import chain __all__ = ["chain"]
langchain/templates/chain-of-note-wiki/chain_of_note_wiki/__init__.py/0
{ "file_path": "langchain/templates/chain-of-note-wiki/chain_of_note_wiki/__init__.py", "repo_id": "langchain", "token_count": 22 }
638
package proxy import ( "context" "fmt" "sort" "strings" "sync" "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus/internal/types" ) func TestRoundRobinPolicy(t *testing.T) { var err error ctx := context.TODO() mgr := newShardClientMgr() shard2leaders := map[string][]nodeInfo{...
milvus/internal/proxy/task_policies_test.go/0
{ "file_path": "milvus/internal/proxy/task_policies_test.go", "repo_id": "milvus", "token_count": 981 }
2,024
apiVersion: apps/v1 kind: Deployment metadata: name: coordinator namespace: chroma spec: replicas: 1 selector: matchLabels: app: coordinator template: metadata: labels: app: coordinator spec: containers: - command: - "chroma" - "coordinator...
chroma/k8s/dev/coordinator.yaml/0
{ "file_path": "chroma/k8s/dev/coordinator.yaml", "repo_id": "chroma", "token_count": 410 }
56
// 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/exec/expression/Utils.h/0
{ "file_path": "milvus/internal/core/src/exec/expression/Utils.h", "repo_id": "milvus", "token_count": 2809 }
1,727
import { expect, test } from '@jest/globals'; import chroma from './initClient' test('it should upsert embeddings to a collection', async () => { await chroma.reset() const collection = await chroma.createCollection({ name: "test" }); const ids = ['test1', 'test2'] const embeddings = [ [1, 2, ...
chroma/clients/js/test/upsert.collections.test.ts/0
{ "file_path": "chroma/clients/js/test/upsert.collections.test.ts", "repo_id": "chroma", "token_count": 352 }
36
# LlamaIndex Multi-Modal-Llms Integration: Azure Openai
llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-azure-openai/README.md/0
{ "file_path": "llama_index/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-azure-openai/README.md", "repo_id": "llama_index", "token_count": 18 }
1,338
from langchain_community.callbacks.wandb_callback import ( WandbCallbackHandler, ) __all__ = [ "WandbCallbackHandler", ]
langchain/libs/langchain/langchain/callbacks/wandb_callback.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/wandb_callback.py", "repo_id": "langchain", "token_count": 48 }
478
export * from "./base.js";
langchainjs/langchain/src/evaluation/embedding_distance/index.ts/0
{ "file_path": "langchainjs/langchain/src/evaluation/embedding_distance/index.ts", "repo_id": "langchainjs", "token_count": 10 }
917
<jupyter_start><jupyter_text>Chat HistoryHere we'll be interacting with a server that's exposing a chat bot with message history being persisted on the backend.<jupyter_code>import uuid from langserve import RemoteRunnable conversation_id = str(uuid.uuid4()) chat = RemoteRunnable("http://localhost:8000/", cookies={"us...
langserve/examples/chat_with_persistence_and_user/client.ipynb/0
{ "file_path": "langserve/examples/chat_with_persistence_and_user/client.ipynb", "repo_id": "langserve", "token_count": 1222 }
996
"""Implementations of key-value stores and storage helpers. Module provides implementations of various key-value stores that conform to a simple key-value interface. The primary goal of these storages is to support implementation of caching. """ import warnings from typing import Any from langchain_core._api import ...
langchain/libs/langchain/langchain/storage/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/storage/__init__.py", "repo_id": "langchain", "token_count": 534 }
580
import os from contextlib import ExitStack from pathlib import Path from langchain_community.document_loaders import ( UnstructuredAPIFileIOLoader, UnstructuredAPIFileLoader, UnstructuredFileLoader, ) EXAMPLE_DOCS_DIRECTORY = str(Path(__file__).parent.parent / "examples/") def test_unstructured_loader_w...
langchain/libs/community/tests/integration_tests/document_loaders/test_unstructured.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_unstructured.py", "repo_id": "langchain", "token_count": 1433 }
332
from typing import Any, Dict, List, Optional, Tuple, cast from llama_index.legacy.storage.kvstore.types import ( DEFAULT_BATCH_SIZE, DEFAULT_COLLECTION, BaseKVStore, ) IMPORT_ERROR_MSG = ( "`pymongo` or `motor` package not found, please run `pip install pymongo motor`" ) class MongoDBKVStore(BaseKVS...
llama_index/llama-index-legacy/llama_index/legacy/storage/kvstore/mongodb_kvstore.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/storage/kvstore/mongodb_kvstore.py", "repo_id": "llama_index", "token_count": 3849 }
1,777
<jupyter_start><jupyter_text>Neo4j DB QA chainThis notebook shows how to use LLMs to provide a natural language interface to a graph database you can query with the Cypher query language. You will need to have a running Neo4j instance. One option is to create a [free Neo4j database instance in their Aura cloud service]...
langchain/docs/docs/use_cases/graph/graph_cypher_qa.ipynb/0
{ "file_path": "langchain/docs/docs/use_cases/graph/graph_cypher_qa.ipynb", "repo_id": "langchain", "token_count": 3100 }
197
<!--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/en/preprocessing.md/0
{ "file_path": "transformers/docs/source/en/preprocessing.md", "repo_id": "transformers", "token_count": 8685 }
523
// 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/metastore/kv/rootcoord/suffix_snapshot_test.go/0
{ "file_path": "milvus/internal/metastore/kv/rootcoord/suffix_snapshot_test.go", "repo_id": "milvus", "token_count": 9128 }
1,726
from langchain_community.retrievers.docarray import DocArrayRetriever, SearchType __all__ = ["SearchType", "DocArrayRetriever"]
langchain/libs/langchain/langchain/retrievers/docarray.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/docarray.py", "repo_id": "langchain", "token_count": 39 }
555
# Usage Pattern ## Getting Started An agent is initialized from a set of Tools. Here's an example of instantiating a ReAct agent from a set of Tools. ```python from llama_index.core.tools import FunctionTool from llama_index.llms.openai import OpenAI from llama_index.core.agent import ReActAgent # define sample To...
llama_index/docs/module_guides/deploying/agents/usage_pattern.md/0
{ "file_path": "llama_index/docs/module_guides/deploying/agents/usage_pattern.md", "repo_id": "llama_index", "token_count": 2420 }
1,153
# coding=utf-8 # Copyright 2023 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 r...
transformers/src/transformers/models/timm_backbone/configuration_timm_backbone.py/0
{ "file_path": "transformers/src/transformers/models/timm_backbone/configuration_timm_backbone.py", "repo_id": "transformers", "token_count": 1106 }
676
# OpenAI Functions Agent - Gmail Ever struggled to reach inbox zero? Using this template, you can create and customize your very own AI assistant to manage your Gmail account. Using the default Gmail tools, it can read, search through, and draft emails to respond on your behalf. It also has access to a Tavily search...
langchain/templates/openai-functions-agent-gmail/README.md/0
{ "file_path": "langchain/templates/openai-functions-agent-gmail/README.md", "repo_id": "langchain", "token_count": 1349 }
655
"""DEPRECATED: Kept for backwards compatibility.""" from langchain_community.utilities import Requests, RequestsWrapper, TextRequestsWrapper __all__ = [ "Requests", "RequestsWrapper", "TextRequestsWrapper", ]
langchain/libs/langchain/langchain/requests.py/0
{ "file_path": "langchain/libs/langchain/langchain/requests.py", "repo_id": "langchain", "token_count": 74 }
530
# Weather Loader This loader fetches the weather data from the [OpenWeatherMap](https://openweathermap.org/api)'s OneCall API, using the `pyowm` Python package. You must initialize the loader with your OpenWeatherMap API token, and then pass in the names of the cities you want the weather data for. OWM's One Call API...
llama_index/llama-index-integrations/readers/llama-index-readers-weather/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-weather/README.md", "repo_id": "llama_index", "token_count": 328 }
1,440
# coding=utf-8 # Copyright 2018 The Google AI Language 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/LICEN...
transformers/src/transformers/models/bert_japanese/tokenization_bert_japanese.py/0
{ "file_path": "transformers/src/transformers/models/bert_japanese/tokenization_bert_japanese.py", "repo_id": "transformers", "token_count": 19114 }
637
// Copyright (C) 2019-2020 Zilliz. 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 l...
milvus/internal/core/src/segcore/segment_c.cpp/0
{ "file_path": "milvus/internal/core/src/segcore/segment_c.cpp", "repo_id": "milvus", "token_count": 6795 }
1,886
<jupyter_start><jupyter_text>Rewrite-Retrieve-ReadYou can also run this notebook online [on Noteable.io](https://app.noteable.io/published/d2cb020b-8341-4cff-b898-be33d3c62e21).**Rewrite-Retrieve-Read** is a method proposed in the paper [Query Rewriting for Retrieval-Augmented Large Language Models](https://arxiv.org/p...
langchainjs/cookbook/rewrite.ipynb/0
{ "file_path": "langchainjs/cookbook/rewrite.ipynb", "repo_id": "langchainjs", "token_count": 1192 }
741
export interface IterableReadableStreamInterface<T> extends ReadableStream<T>, AsyncIterable<T> {} /* * Support async iterator syntax for ReadableStreams in all environments. * Source: https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490 */ export class IterableReadableStrea...
langchainjs/langchain-core/src/utils/stream.ts/0
{ "file_path": "langchainjs/langchain-core/src/utils/stream.ts", "repo_id": "langchainjs", "token_count": 2870 }
846
<!--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 applicable law or agreed...
transformers/docs/source/en/model_doc/longformer.md/0
{ "file_path": "transformers/docs/source/en/model_doc/longformer.md", "repo_id": "transformers", "token_count": 2395 }
479
const assert = require("assert"); const { OpenAI } = require("langchain/llms/openai"); const { LLMChain } = require("langchain/chains"); const { ChatPromptTemplate } = require("langchain/prompts"); const { loadPrompt } = require("langchain/prompts/load"); const { HNSWLib } = require("langchain/vectorstores/hnswlib"); c...
langchainjs/environment_tests/test-exports-cjs/src/require.js/0
{ "file_path": "langchainjs/environment_tests/test-exports-cjs/src/require.js", "repo_id": "langchainjs", "token_count": 596 }
762
# Sentence Window Retriever This LlamaPack provides an example of our sentence window retriever. This specific template shows the e2e process of building this. It loads a document, chunks it up, adds surrounding context as metadata to each chunk, and during retrieval inserts the context back into each chunk for respo...
llama_index/llama-index-packs/llama-index-packs-sentence-window-retriever/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-sentence-window-retriever/README.md", "repo_id": "llama_index", "token_count": 627 }
1,675
from langchain_community.chat_models.azureml_endpoint import ( AzureMLChatOnlineEndpoint, LlamaContentFormatter, ) __all__ = ["LlamaContentFormatter", "AzureMLChatOnlineEndpoint"]
langchain/libs/langchain/langchain/chat_models/azureml_endpoint.py/0
{ "file_path": "langchain/libs/langchain/langchain/chat_models/azureml_endpoint.py", "repo_id": "langchain", "token_count": 65 }
469
python_tests( name="tests", skip_tests=True, ) python_sources()
llama_index/llama-index-legacy/tests/token_predictor/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/token_predictor/BUILD", "repo_id": "llama_index", "token_count": 32 }
1,822
use candle_core::backend::BackendStorage; use candle_core::cpu_backend; use candle_core::test_utils::to_vec1_round; use candle_core::{CpuStorage, CustomOp1, DType, Device, Error, Layout, Result, Shape, Tensor}; fn fwd<T: num_traits::Float>(v: T, alpha: f64) -> T { if v.is_sign_positive() { v } else { ...
candle/candle-core/tests/custom_op_tests.rs/0
{ "file_path": "candle/candle-core/tests/custom_op_tests.rs", "repo_id": "candle", "token_count": 1542 }
37
from langchain_community.document_loaders.fauna import FaunaLoader __all__ = ["FaunaLoader"]
langchain/libs/langchain/langchain/document_loaders/fauna.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/fauna.py", "repo_id": "langchain", "token_count": 29 }
514
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "tools/dataforseo_api_search", }); export * from "@langchain/community/tools/dataforseo_api_search";
langchainjs/langchain/src/tools/dataforseo_api_search.ts/0
{ "file_path": "langchainjs/langchain/src/tools/dataforseo_api_search.ts", "repo_id": "langchainjs", "token_count": 82 }
956
// 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/storage/data_sorter.go/0
{ "file_path": "milvus/internal/storage/data_sorter.go", "repo_id": "milvus", "token_count": 1802 }
1,791
import { Document } from "@langchain/core/documents"; import { BufferLoader } from "./buffer.js"; /** * A class that extends the `BufferLoader` class. It represents a document * loader that loads documents from DOCX files. */ export class DocxLoader extends BufferLoader { constructor(filePathOrBlob: string | Blob...
langchainjs/langchain/src/document_loaders/fs/docx.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/fs/docx.ts", "repo_id": "langchainjs", "token_count": 550 }
862
<!--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/en/model_doc/tvlt.md/0
{ "file_path": "transformers/docs/source/en/model_doc/tvlt.md", "repo_id": "transformers", "token_count": 1149 }
520
#include "compatibility.cuh" #include<stdint.h> #include<cmath> // TODO: This is often used to check that the data is contiguous so that // kernels can be easily mapped. However this only returns true for row // major, if all the inputs are column major, we could apply the fast path // too (but we wouldn't if some of ...
candle/candle-kernels/src/cuda_utils.cuh/0
{ "file_path": "candle/candle-kernels/src/cuda_utils.cuh", "repo_id": "candle", "token_count": 3936 }
63
# 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/longt5/convert_longt5x_checkpoint_to_flax.py/0
{ "file_path": "transformers/src/transformers/models/longt5/convert_longt5x_checkpoint_to_flax.py", "repo_id": "transformers", "token_count": 4985 }
660
import { PARQUET_EXPORT_DATASET, PARQUET_EXPORT_HF_TOKEN, PARQUET_EXPORT_SECRET, } from "$env/static/private"; import { collections } from "$lib/server/database"; import type { Message } from "$lib/types/Message"; import { error } from "@sveltejs/kit"; import { pathToFileURL } from "node:url"; import { unlink } from...
chat-ui/src/routes/admin/export/+server.ts/0
{ "file_path": "chat-ui/src/routes/admin/export/+server.ts", "repo_id": "chat-ui", "token_count": 1727 }
108
# Required Environment Variables: OPENAI_API_KEY from llama_index.core.llama_pack import download_llama_pack from llama_index.core.node_parser import SentenceSplitter from llama_index.core.readers.web import SimpleWebPageReader from tqdm.auto import tqdm # download and install dependencies ArizePhoenixQueryEnginePack...
llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/examples/example.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-arize-phoenix-query-engine/examples/example.py", "repo_id": "llama_index", "token_count": 513 }
1,555
"""OpenAPI Tool.""" from typing import List, Optional import requests from llama_index.core.schema import Document from llama_index.core.tools.tool_spec.base import BaseToolSpec class OpenAPIToolSpec(BaseToolSpec): """OpenAPI Tool. This tool can be used to parse an OpenAPI spec for endpoints and operations...
llama_index/llama-index-integrations/tools/llama-index-tools-openapi/llama_index/tools/openapi/base.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-openapi/llama_index/tools/openapi/base.py", "repo_id": "llama_index", "token_count": 1851 }
1,450
# Metric Card for Accuracy ## Metric Description Accuracy is the proportion of correct predictions among the total number of cases processed. It can be computed with: Accuracy = (TP + TN) / (TP + TN + FP + FN) Where: TP: True positive TN: True negative FP: False positive FN: False negative ## How to Use At minim...
datasets/metrics/accuracy/README.md/0
{ "file_path": "datasets/metrics/accuracy/README.md", "repo_id": "datasets", "token_count": 1120 }
114
from neo4j_cypher.chain import chain __all__ = ["chain"]
langchain/templates/neo4j-cypher/neo4j_cypher/__init__.py/0
{ "file_path": "langchain/templates/neo4j-cypher/neo4j_cypher/__init__.py", "repo_id": "langchain", "token_count": 21 }
711
# Loading Data (Ingestion) Before your chosen LLM can act on your data, you first need to process the data and load it. This has parallels to data cleaning/feature engineering pipelines in the ML world, or ETL pipelines in the traditional data setting. This ingestion pipeline typically consists of three main stages: ...
llama_index/docs/understanding/loading/loading.md/0
{ "file_path": "llama_index/docs/understanding/loading/loading.md", "repo_id": "llama_index", "token_count": 1899 }
1,186
# Masking The experimental masking parser and transformer is an extendable module for masking and rehydrating strings. One of the primary use cases for this module is to redact PII (Personal Identifiable Information) from a string before making a call to an llm. ### Real world scenario A customer support system rece...
langchainjs/docs/core_docs/docs/modules/experimental/mask/mask.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/experimental/mask/mask.mdx", "repo_id": "langchainjs", "token_count": 455 }
734
from langchain_community.embeddings.ernie import ErnieEmbeddings __all__ = ["ErnieEmbeddings"]
langchain/libs/langchain/langchain/embeddings/ernie.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/ernie.py", "repo_id": "langchain", "token_count": 32 }
545
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/query_pipeline/components/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/query_pipeline/components/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,699
from langchain.agents import __all__ as agents_all _EXPECTED = [ "Agent", "AgentExecutor", "AgentExecutorIterator", "AgentOutputParser", "AgentType", "BaseMultiActionAgent", "BaseSingleActionAgent", "ConversationalAgent", "ConversationalChatAgent", "LLMSingleActionAgent", "M...
langchain/libs/langchain/tests/unit_tests/agents/test_public_api.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/test_public_api.py", "repo_id": "langchain", "token_count": 526 }
596
# Multi-Tenancy RAG Pack Create a Multi-Tenancy RAG using VectorStoreIndex. ## CLI Usage You can download llamapacks directly using `llamaindex-cli`, which comes installed with the `llama-index` python package: ```bash llamaindex-cli download-llamapack MultiTenancyRAGPack --download-dir ./multitenancy_rag_pack ``` ...
llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/README.md/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/README.md", "repo_id": "llama_index", "token_count": 671 }
1,854
<!--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/perf_train_tpu_tf.md/0
{ "file_path": "transformers/docs/source/ja/perf_train_tpu_tf.md", "repo_id": "transformers", "token_count": 7360 }
523
# Psychic >[Psychic](https://www.psychic.dev/) is a platform for integrating with SaaS tools like `Notion`, `Zendesk`, > `Confluence`, and `Google Drive` via OAuth and syncing documents from these applications to your SQL or vector > database. You can think of it like Plaid for unstructured data. ## Installation an...
langchain/docs/docs/integrations/providers/psychic.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/psychic.mdx", "repo_id": "langchain", "token_count": 444 }
156
python_sources()
llama_index/llama-index-core/llama_index/core/bridge/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/bridge/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,163
"""Tests for the Mastodon toots loader""" from langchain_community.document_loaders import MastodonTootsLoader def test_mastodon_toots_loader() -> None: """Test Mastodon toots loader with an external query.""" # Query the Mastodon CEO's account loader = MastodonTootsLoader( mastodon_accounts=["@Ga...
langchain/libs/community/tests/integration_tests/document_loaders/test_mastodon.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_mastodon.py", "repo_id": "langchain", "token_count": 164 }
329
// 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/storage/data_sorter_test.go/0
{ "file_path": "milvus/internal/storage/data_sorter_test.go", "repo_id": "milvus", "token_count": 4515 }
1,785
search_performance: collections: - server: db_config.primary_path: /test/milvus/db_data_070/jaccard_50m_512_512_jaccard_wal cache_config.cpu_cache_capacity: 32 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: fa...
milvus/tests/benchmark/milvus_benchmark/suites/cpu_search_performance_jaccard.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/cpu_search_performance_jaccard.yaml", "repo_id": "milvus", "token_count": 341 }
2,094
from typing import TYPE_CHECKING, Optional, Tuple, Any, Union import numpy as np from pydantic import BaseModel, PrivateAttr from uuid import UUID import chromadb.utils.embedding_functions as ef from chromadb.api.types import ( URI, CollectionMetadata, DataLoader, Embedding, Embeddings, Embed...
chroma/chromadb/api/models/Collection.py/0
{ "file_path": "chroma/chromadb/api/models/Collection.py", "repo_id": "chroma", "token_count": 10621 }
12
<jupyter_start><jupyter_text>Eden AI This Jupyter Notebook demonstrates how to use Eden AI tools with an Agent.Eden AI is revolutionizing the AI landscape by uniting the best AI providers, empowering users to unlock limitless possibilities and tap into the true potential of artificial intelligence. With an all-in-one c...
langchain/docs/docs/integrations/tools/edenai_tools.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/edenai_tools.ipynb", "repo_id": "langchain", "token_count": 1880 }
179
-- create database CREATE DATABASE if not exists milvus_meta CHARACTER SET utf8mb4; /* create tables script Notices: 1. id, tenant_id, is_deleted, created_at, updated_at are 5 common columns for all collections. 2. Query index in community version CANNOT includes tenant_id, since tenant_id is not existed an...
milvus/scripts/sql/meta.sql/0
{ "file_path": "milvus/scripts/sql/meta.sql", "repo_id": "milvus", "token_count": 4395 }
2,129
# flake8: noqa """Test Llama.cpp wrapper.""" import os from urllib.request import urlretrieve from langchain_community.llms import GPT4All def _download_model() -> str: """Download model.""" model_url = "http://gpt4all.io/models/ggml-gpt4all-l13b-snoozy.bin" local_filename = model_url.split("/")[-1] ...
langchain/libs/community/tests/integration_tests/llms/test_gpt4all.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_gpt4all.py", "repo_id": "langchain", "token_count": 256 }
358
from llama_index.readers.confluence.base import ConfluenceReader __all__ = ["ConfluenceReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-confluence/llama_index/readers/confluence/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-confluence/llama_index/readers/confluence/__init__.py", "repo_id": "llama_index", "token_count": 29 }
1,303
<jupyter_start><jupyter_text>Diffbot>Unlike traditional web scraping tools, [Diffbot](https://docs.diffbot.com/docs) doesn't require any rules to read the content on a page.>It starts with computer vision, which classifies a page into one of 20 possible types. Content is then interpreted by a machine learning model tra...
langchain/docs/docs/integrations/document_loaders/diffbot.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/diffbot.ipynb", "repo_id": "langchain", "token_count": 383 }
106
# Script for converting a Hugging Face Diffusers trained SDXL LoRAs to Kohya format # This means that you can input your diffusers-trained LoRAs and # Get the output to work with WebUIs such as AUTOMATIC1111, ComfyUI, SD.Next and others. # To get started you can find some cool `diffusers` trained LoRAs such as this cu...
diffusers/scripts/convert_diffusers_sdxl_lora_to_webui.py/0
{ "file_path": "diffusers/scripts/convert_diffusers_sdxl_lora_to_webui.py", "repo_id": "diffusers", "token_count": 1027 }
203
python_sources()
llama_index/llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/llama_index/response_synthesizers/google/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/llama_index/response_synthesizers/google/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,399
"""Util that calls Google Search.""" from typing import Any, Dict, List, Optional from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_core.utils import get_from_dict_or_env class GoogleSearchAPIWrapper(BaseModel): """Wrapper for Google Search API. Adapted from: Instruction...
langchain/libs/community/langchain_community/utilities/google_search.py/0
{ "file_path": "langchain/libs/community/langchain_community/utilities/google_search.py", "repo_id": "langchain", "token_count": 1999 }
322
{ "openapi": "3.0.1", "info": { "title": "Speak", "description": "Learn how to say anything in another language.", "version": "v1" }, "servers": [ { "url": "https://api.speak.com" } ], "paths": { "/v1/public/openai/translate": { "post": { ...
langchain/libs/community/tests/unit_tests/examples/test_specs/speak/apispec.json/0
{ "file_path": "langchain/libs/community/tests/unit_tests/examples/test_specs/speak/apispec.json", "repo_id": "langchain", "token_count": 4816 }
396
// 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/unmarshal.go/0
{ "file_path": "milvus/pkg/mq/msgstream/unmarshal.go", "repo_id": "milvus", "token_count": 1402 }
1,829
<!--Copyright 2024 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...
diffusers/docs/source/pt/installation.md/0
{ "file_path": "diffusers/docs/source/pt/installation.md", "repo_id": "diffusers", "token_count": 2101 }
195
# langchain-exa
langchain/libs/partners/exa/README.md/0
{ "file_path": "langchain/libs/partners/exa/README.md", "repo_id": "langchain", "token_count": 7 }
662
<jupyter_start><jupyter_text>Building an Advanced Fusion Retriever from ScratchIn this tutorial, we show you how to build an advanced retriever from scratch.Specifically, we show you how to build our `QueryFusionRetriever` from scratch.This is heavily inspired from the RAG-fusion repo here: https://github.com/Raudaschl...
llama_index/docs/examples/low_level/fusion_retriever.ipynb/0
{ "file_path": "llama_index/docs/examples/low_level/fusion_retriever.ipynb", "repo_id": "llama_index", "token_count": 3093 }
1,130
# Cancelling requests You can cancel a LCEL request by binding a `signal`. import CodeBlock from "@theme/CodeBlock"; import CancellationExample from "@examples/guides/expression_language/how_to_cancellation.ts"; import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationIns...
langchainjs/docs/core_docs/docs/expression_language/how_to/cancellation.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/expression_language/how_to/cancellation.mdx", "repo_id": "langchainjs", "token_count": 186 }
704
"""Document Loader for ArcGIS FeatureLayers.""" from __future__ import annotations import json import re import warnings from datetime import datetime, timezone from typing import TYPE_CHECKING, Any, Iterator, List, Optional, Union from langchain_core.documents import Document from langchain_community.document_load...
langchain/libs/community/langchain_community/document_loaders/arcgis_loader.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/arcgis_loader.py", "repo_id": "langchain", "token_count": 2476 }
229
# 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 applicabl...
diffusers/scripts/convert_vae_diff_to_onnx.py/0
{ "file_path": "diffusers/scripts/convert_vae_diff_to_onnx.py", "repo_id": "diffusers", "token_count": 1684 }
207