text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
// 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/proxy/proxy.go/0
{ "file_path": "milvus/internal/proxy/proxy.go", "repo_id": "milvus", "token_count": 6323 }
1,830
<!--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/en/model_doc/mvp.md/0
{ "file_path": "transformers/docs/source/en/model_doc/mvp.md", "repo_id": "transformers", "token_count": 1922 }
497
<jupyter_start><jupyter_text>Aleph Alpha[The Luminous series](https://docs.aleph-alpha.com/docs/introduction/luminous/) is a family of large language models.This example goes over how to use LangChain to interact with Aleph Alpha models<jupyter_code># Install the package %pip install --upgrade --quiet aleph-alpha-clie...
langchain/docs/docs/integrations/llms/aleph_alpha.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/aleph_alpha.ipynb", "repo_id": "langchain", "token_count": 320 }
124
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-intercom/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-intercom/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,317
<jupyter_start><jupyter_text>Blockchain Overview The intention of this notebook is to provide a means of testing functionality in the Langchain Document Loader for Blockchain.Initially this Loader supports:* Loading NFTs as Documents from NFT Smart Contracts (ERC721 and ERC1155)* Ethereum Mainnnet, Ethereum Testne...
langchain/docs/docs/integrations/document_loaders/blockchain.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/blockchain.ipynb", "repo_id": "langchain", "token_count": 653 }
95
# Add patterns of files dvc should ignore, which could improve # the performance. Learn more at # https://dvc.org/doc/user-guide/dvcignore
datasets/.dvcignore/0
{ "file_path": "datasets/.dvcignore", "repo_id": "datasets", "token_count": 40 }
124
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-gradio-react-agent-chatbot/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,587
from llama_index.extractors.entity import EntityExtractor def test_extractor_class(): # TODO: mock the entity extractor assert EntityExtractor.class_name() == "EntityExtractor"
llama_index/llama-index-integrations/extractors/llama-index-extractors-entity/tests/test_extractors_entity.py/0
{ "file_path": "llama_index/llama-index-integrations/extractors/llama-index-extractors-entity/tests/test_extractors_entity.py", "repo_id": "llama_index", "token_count": 58 }
1,203
// 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/datanode/flow_graph_message.go/0
{ "file_path": "milvus/internal/datanode/flow_graph_message.go", "repo_id": "milvus", "token_count": 709 }
1,837
# 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/tests/models/dpt/test_modeling_dpt_auto_backbone.py/0
{ "file_path": "transformers/tests/models/dpt/test_modeling_dpt_auto_backbone.py", "repo_id": "transformers", "token_count": 5415 }
719
// 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/querycoordv2/meta/target_manager_test.go/0
{ "file_path": "milvus/internal/querycoordv2/meta/target_manager_test.go", "repo_id": "milvus", "token_count": 7307 }
1,979
from typing import Any, Dict, List, Mapping, Optional import requests from langchain_core.callbacks import CallbackManagerForLLMRun from langchain_core.language_models.llms import LLM from langchain_core.pydantic_v1 import Extra, root_validator from langchain_core.utils import get_from_dict_or_env from langchain_comm...
langchain/libs/community/langchain_community/llms/huggingface_endpoint.py/0
{ "file_path": "langchain/libs/community/langchain_community/llms/huggingface_endpoint.py", "repo_id": "langchain", "token_count": 2499 }
269
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/question_gen/llama-index-question-gen-guidance/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/question_gen/llama-index-question-gen-guidance/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,361
/* eslint-disable import/first */ /* eslint-disable arrow-body-style */ /* eslint-disable import/no-duplicates */ import { ChatOpenAI } from "@langchain/openai"; const chat = new ChatOpenAI({ modelName: "gpt-3.5-turbo-1106", temperature: 0.2, }); import { CheerioWebBaseLoader } from "langchain/document_loaders/w...
langchainjs/examples/src/use_cases/chatbots/retrieval.ts/0
{ "file_path": "langchainjs/examples/src/use_cases/chatbots/retrieval.ts", "repo_id": "langchainjs", "token_count": 1812 }
845
reviewers: - XuanYang-cn - yhmo approvers: - maintainers
milvus/scripts/OWNERS/0
{ "file_path": "milvus/scripts/OWNERS", "repo_id": "milvus", "token_count": 29 }
2,070
"""Test knowledge graph index.""" from typing import Any, Dict, List, Tuple from unittest.mock import patch import pytest from llama_index.legacy.embeddings.base import BaseEmbedding from llama_index.legacy.indices.knowledge_graph.base import KnowledgeGraphIndex from llama_index.legacy.schema import Document, TextNod...
llama_index/llama-index-legacy/tests/indices/knowledge_graph/test_base.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/knowledge_graph/test_base.py", "repo_id": "llama_index", "token_count": 3347 }
1,798
import pytest @pytest.fixture(scope="module") def t5_sharded_handle(launcher): with launcher("google/flan-t5-xxl", num_shard=2) as handle: yield handle @pytest.fixture(scope="module") async def t5_sharded(t5_sharded_handle): await t5_sharded_handle.health(300) return t5_sharded_handle.client @...
text-generation-inference/integration-tests/models/test_t5_sharded.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_t5_sharded.py", "repo_id": "text-generation-inference", "token_count": 427 }
408
import pytest from langchain_community.tools.ddg_search.tool import ( DuckDuckGoSearchResults, DuckDuckGoSearchRun, ) def ddg_installed() -> bool: try: from duckduckgo_search import DDGS # noqa: F401 return True except Exception as e: print(f"duckduckgo not installed, skippi...
langchain/libs/community/tests/integration_tests/utilities/test_duckduckdgo_search_api.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/utilities/test_duckduckdgo_search_api.py", "repo_id": "langchain", "token_count": 365 }
344
python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/param_tuner/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/param_tuner/BUILD", "repo_id": "llama_index", "token_count": 25 }
1,629
// 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/util/importutil/binlog_file.go/0
{ "file_path": "milvus/internal/util/importutil/binlog_file.go", "repo_id": "milvus", "token_count": 8358 }
2,073
<!--- 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 ...
transformers/docs/source/it/installation.md/0
{ "file_path": "transformers/docs/source/it/installation.md", "repo_id": "transformers", "token_count": 3575 }
486
from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.image_retriever import BaseImageRetriever from llama_index.core.indices.empty.retrievers import EmptyIndexRetriever from llama_index.core.indices.keyword_table.retrievers import ( KeywordTableSimpleRetriever, ) from llama_index.cor...
llama_index/llama-index-core/llama_index/core/retrievers/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/retrievers/__init__.py", "repo_id": "llama_index", "token_count": 917 }
1,175
--- sidebar_label: Google PaLM --- import CodeBlock from "@theme/CodeBlock"; # ChatGooglePaLM :::note This integration does not support `gemini-*` models. Check [Google AI](/docs/integrations/chat/google_generativeai). ::: The [Google PaLM API](https://developers.generativeai.google/products/palm) can be integrated...
langchainjs/docs/core_docs/docs/integrations/chat/google_palm.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/chat/google_palm.mdx", "repo_id": "langchainjs", "token_count": 302 }
774
import { FaissStore } from "@langchain/community/vectorstores/faiss"; import { OpenAIEmbeddings } from "@langchain/openai"; export const run = async () => { const vectorStore = await FaissStore.fromTexts( ["Hello world", "Bye bye", "hello nice world"], [{ id: 2 }, { id: 1 }, { id: 3 }], new OpenAIEmbeddi...
langchainjs/examples/src/indexes/vector_stores/faiss.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/faiss.ts", "repo_id": "langchainjs", "token_count": 147 }
784
import { CheerioWebBaseLoader } from "langchain/document_loaders/web/cheerio"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import { HtmlToTextTransformer } from "@langchain/community/document_transformers/html_to_text"; const loader = new CheerioWebBaseLoader( "https://news.ycombinator....
langchainjs/examples/src/document_transformers/html_to_text.ts/0
{ "file_path": "langchainjs/examples/src/document_transformers/html_to_text.ts", "repo_id": "langchainjs", "token_count": 1748 }
857
# Res2NeXt **Res2NeXt** is an image model that employs a variation on [ResNeXt](https://paperswithcode.com/method/resnext) bottleneck residual blocks. The motivation is to be able to represent features at multiple scales. This is achieved through a novel building block for CNNs that constructs hierarchical residual-li...
pytorch-image-models/hfdocs/source/models/res2next.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/res2next.mdx", "repo_id": "pytorch-image-models", "token_count": 1711 }
375
--- sidebar_label: Callbacks in custom Chains --- # Callbacks in custom Chains/Agents LangChain is designed to be extensible. You can add your own custom Chains and Agents to the library. This page will show you how to add callbacks to your custom Chains and Agents. ## Adding callbacks to custom Chains When you cre...
langchainjs/docs/core_docs/docs/modules/callbacks/how_to/creating_subclasses.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/callbacks/how_to/creating_subclasses.mdx", "repo_id": "langchainjs", "token_count": 139 }
803
<jupyter_start><jupyter_text>PubMed>[PubMed®](https://pubmed.ncbi.nlm.nih.gov/) by `The National Center for Biotechnology Information, National Library of Medicine` comprises more than 35 million citations for biomedical literature from `MEDLINE`, life science journals, and online books. Citations may include links to ...
langchain/docs/docs/integrations/retrievers/pubmed.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/retrievers/pubmed.ipynb", "repo_id": "langchain", "token_count": 167 }
169
label: 'Templates' position: 4
langchainjs/docs/core_docs/docs/get_started/_category_.yml/0
{ "file_path": "langchainjs/docs/core_docs/docs/get_started/_category_.yml", "repo_id": "langchainjs", "token_count": 10 }
718
<jupyter_start><jupyter_text>PaLM In this short notebook, we show how to use the PaLM LLM from Google in LlamaIndex: https://ai.google/discover/palm2/.We use the `text-bison-001` model by default. Setup If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install...
llama_index/docs/examples/llm/palm.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/palm.ipynb", "repo_id": "llama_index", "token_count": 355 }
1,111
import { MongoDBAtlasVectorSearch } from "@langchain/community/vectorstores/mongodb_atlas"; import { CohereEmbeddings } from "@langchain/cohere"; import { MongoClient } from "mongodb"; const client = new MongoClient(process.env.MONGODB_ATLAS_URI || ""); const namespace = "langchain.test"; const [dbName, collectionName...
langchainjs/examples/src/indexes/vector_stores/mongodb_mmr.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/mongodb_mmr.ts", "repo_id": "langchainjs", "token_count": 389 }
787
from llama_index.tools.text_to_image.base import TextToImageToolSpec __all__ = ["TextToImageToolSpec"]
llama_index/llama-index-integrations/tools/llama-index-tools-text-to-image/llama_index/tools/text_to_image/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-text-to-image/llama_index/tools/text_to_image/__init__.py", "repo_id": "llama_index", "token_count": 35 }
1,584
# Supporting Modules ```{toctree} --- maxdepth: 1 --- /optimizing/advanced_retrieval/query_transformations.md ```
llama_index/docs/module_guides/deploying/query_engine/supporting_modules.md/0
{ "file_path": "llama_index/docs/module_guides/deploying/query_engine/supporting_modules.md", "repo_id": "llama_index", "token_count": 44 }
1,154
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-packs/llama-index-packs-fuzzy-citation/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-fuzzy-citation/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,655
import { expect, test } from "@jest/globals"; import { DataSource } from "typeorm"; import { OpenAI } from "@langchain/openai"; import { SqlDatabaseChain } from "../sql_db/sql_db_chain.js"; import { SqlDatabase } from "../../sql_db.js"; import { SQL_SQLITE_PROMPT } from "../sql_db/sql_db_prompt.js"; test("Test SqlData...
langchainjs/langchain/src/chains/tests/sql_db_chain.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/chains/tests/sql_db_chain.int.test.ts", "repo_id": "langchainjs", "token_count": 5006 }
859
from llama_index.core.readers.base import BaseReader from llama_index.readers.remote_depth import RemoteDepthReader def test_class(): names_of_base_classes = [b.__name__ for b in RemoteDepthReader.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-remote-depth/tests/test_readers_remote_depth.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-remote-depth/tests/test_readers_remote_depth.py", "repo_id": "llama_index", "token_count": 89 }
1,435
<jupyter_start><jupyter_text>Text Embedding InferenceThis notebook demonstrates how to configure `TextEmbeddingInference` embeddings.The first step is to deploy the embeddings server. For detailed instructions, see the [official repository for Text Embeddings Inference](https://github.com/huggingface/text-embeddings-in...
llama_index/docs/examples/embeddings/text_embedding_inference.ipynb/0
{ "file_path": "llama_index/docs/examples/embeddings/text_embedding_inference.ipynb", "repo_id": "llama_index", "token_count": 406 }
1,182
export interface StreamCallback { onSuccess?: (ctx: { input: unknown; output: unknown }) => void; onError?: () => void; onStart?: (ctx: { input: unknown }) => void; }
langserve/langserve/playground/src/types.tsx/0
{ "file_path": "langserve/langserve/playground/src/types.tsx", "repo_id": "langserve", "token_count": 53 }
1,051
<jupyter_start><jupyter_text>BagelDB> [BagelDB](https://www.bageldb.ai/) (`Open Vector Database for AI`), is like GitHub for AI data.It is a collaborative platform where users can create,share, and manage vector datasets. It can support private projects for independent developers,internal collaborations for enterprises...
langchain/docs/docs/integrations/vectorstores/bageldb.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/bageldb.ipynb", "repo_id": "langchain", "token_count": 759 }
189
"""Init file.""" from llama_index.readers.mangadex.base import MangaDexReader __all__ = ["MangaDexReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-mangadex/llama_index/readers/mangadex/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mangadex/llama_index/readers/mangadex/__init__.py", "repo_id": "llama_index", "token_count": 38 }
1,516
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-hubspot/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-hubspot/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,313
apiVersion: chaos-mesh.org/v1alpha1 kind: PodChaos metadata: name: test-proxy-pod-failure namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/instance: milvus-chaos component: proxy mode: fixed value: "1" action: pod-failure dura...
milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_proxy_pod_failure.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_proxy_pod_failure.yaml", "repo_id": "milvus", "token_count": 139 }
1,897
import { PromptTemplate } from "@langchain/core/prompts"; export const run = async () => { // The `partial` method returns a new `PromptTemplate` object that can be used to format the prompt with only some of the input variables. const promptA = new PromptTemplate({ template: "{foo}{bar}", inputVariables: ...
langchainjs/examples/src/prompts/partial.ts/0
{ "file_path": "langchainjs/examples/src/prompts/partial.ts", "repo_id": "langchainjs", "token_count": 498 }
848
compute_environment: LOCAL_MACHINE deepspeed_config: {} distributed_type: 'NO' fsdp_config: {} machine_rank: 0 main_process_ip: null main_process_port: null main_training_function: main mixed_precision: 'no' num_machines: 1 num_processes: 1 use_cpu: false
accelerate/tests/test_configs/0_11_0.yaml/0
{ "file_path": "accelerate/tests/test_configs/0_11_0.yaml", "repo_id": "accelerate", "token_count": 95 }
19
import { CohereRerank } from "@langchain/cohere"; import { Document } from "@langchain/core/documents"; const query = "What is the capital of the United States?"; const docs = [ new Document({ pageContent: "Carson City is the capital city of the American state of Nevada. At the 2010 United States Census, C...
langchainjs/examples/src/document_compressors/cohere_rerank.ts/0
{ "file_path": "langchainjs/examples/src/document_compressors/cohere_rerank.ts", "repo_id": "langchainjs", "token_count": 577 }
796
# Petals This page covers how to use the Petals ecosystem within LangChain. It is broken into two parts: installation and setup, and then references to specific Petals wrappers. ## Installation and Setup - Install with `pip install petals` - Get a Hugging Face api key and set it as an environment variable (`HUGGINGFA...
langchain/docs/docs/integrations/providers/petals.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/petals.mdx", "repo_id": "langchain", "token_count": 134 }
144
import json import pytest import responses from langchain_community.utilities.graphql import GraphQLAPIWrapper TEST_ENDPOINT = "http://testserver/graphql" # Mock GraphQL response for testing MOCK_RESPONSE = { "data": { "allUsers": [{"name": "Alice"}], "__schema": { "queryType": {"nam...
langchain/libs/community/tests/unit_tests/utilities/test_graphql.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/utilities/test_graphql.py", "repo_id": "langchain", "token_count": 1999 }
383
from llama_index.core.selectors.embedding_selectors import EmbeddingSingleSelector from llama_index.core.selectors.llm_selectors import ( LLMMultiSelector, LLMSingleSelector, ) from llama_index.core.selectors.pydantic_selectors import ( PydanticMultiSelector, PydanticSingleSelector, ) __all__ = [ "...
llama_index/llama-index-core/llama_index/core/selectors/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/selectors/__init__.py", "repo_id": "llama_index", "token_count": 178 }
1,176
# langchain-openai This package contains the LangChain integrations for OpenAI through their `openai` SDK. ## Installation and Setup - Install the LangChain partner package ```bash pip install langchain-openai ``` - Get an OpenAI api key and set it as an environment variable (`OPENAI_API_KEY`) ## LLM See a [usage...
langchain/libs/partners/openai/README.md/0
{ "file_path": "langchain/libs/partners/openai/README.md", "repo_id": "langchain", "token_count": 499 }
674
# Using VectorStoreIndex Vector Stores are a key component of retrieval-augmented generation (RAG) and so you will end up using them in nearly every application you make using LlamaIndex, either directly or indirectly. Vector stores accept a list of [`Node` objects](/module_guides/loading/documents_and_nodes/root.md)...
llama_index/docs/module_guides/indexing/vector_store_index.md/0
{ "file_path": "llama_index/docs/module_guides/indexing/vector_store_index.md", "repo_id": "llama_index", "token_count": 1722 }
1,177
# 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/rwkv/convert_rwkv_checkpoint_to_hf.py/0
{ "file_path": "transformers/src/transformers/models/rwkv/convert_rwkv_checkpoint_to_hf.py", "repo_id": "transformers", "token_count": 2938 }
690
"""Test Meilisearch functionality.""" from typing import TYPE_CHECKING, Generator import pytest import requests from langchain_core.documents import Document from langchain_community.vectorstores import Meilisearch from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings if TYPE_CHECKING: ...
langchain/libs/community/tests/integration_tests/vectorstores/test_meilisearch.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_meilisearch.py", "repo_id": "langchain", "token_count": 2530 }
356
"""init params."""
llama_index/llama-index-legacy/llama_index/legacy/tools/tool_spec/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/tools/tool_spec/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,542
import json import re from typing import Union from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from langchain.agents.agent import AgentOutputParser from langchain.agents.chat.prompt import FORMAT_INSTRUCTIONS FINAL_ANSWER_ACTION = "Final Answer:"...
langchain/libs/langchain/langchain/agents/output_parsers/react_json_single_input.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/output_parsers/react_json_single_input.py", "repo_id": "langchain", "token_count": 972 }
469
# Schedulers For more information on the schedulers, please refer to the [docs](https://huggingface.co/docs/diffusers/api/schedulers/overview).
diffusers/src/diffusers/schedulers/README.md/0
{ "file_path": "diffusers/src/diffusers/schedulers/README.md", "repo_id": "diffusers", "token_count": 46 }
263
import { test } from "@jest/globals"; import * as fs from "node:fs/promises"; import { fileURLToPath } from "node:url"; import * as path from "node:path"; import { HumanMessage } from "@langchain/core/messages"; import { ChatGoogleGenerativeAI } from "../chat_models.js"; test("Test Google AI", async () => { const mo...
langchainjs/libs/langchain-google-genai/src/tests/chat_models.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-google-genai/src/tests/chat_models.int.test.ts", "repo_id": "langchainjs", "token_count": 1434 }
1,017
#!/usr/bin/env bash # 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...
milvus/scripts/standalone_embed.sh/0
{ "file_path": "milvus/scripts/standalone_embed.sh", "repo_id": "milvus", "token_count": 1444 }
2,073
import math import tempfile from typing import List, Optional import numpy as np import PIL.Image import torch from accelerate import Accelerator from torchvision import transforms from tqdm.auto import tqdm from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DiffusionPipeline, ...
diffusers/examples/community/sde_drag.py/0
{ "file_path": "diffusers/examples/community/sde_drag.py", "repo_id": "diffusers", "token_count": 11664 }
209
// 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/querycoordv2/checkers/util_test.go/0
{ "file_path": "milvus/internal/querycoordv2/checkers/util_test.go", "repo_id": "milvus", "token_count": 1379 }
1,859
import type { VectorStoreInterface } from "@langchain/core/vectorstores"; import { Comparators, Operators } from "../../chains/query_constructor/ir.js"; import { BasicTranslator } from "./base.js"; /** * Specialized translator class that extends the BasicTranslator. It is * designed to work with PineconeStore, a typ...
langchainjs/langchain/src/retrievers/self_query/pinecone.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/self_query/pinecone.ts", "repo_id": "langchainjs", "token_count": 433 }
982
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL.Image from ....utils import ( BaseOutput, ) @dataclass # Copied from diffusers.pipelines.stable_diffusion.pipeline_output.StableDiffusionPipelineOutput with Stable->Alt class AltDiffusionPipelineOutput(BaseO...
diffusers/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_output.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/alt_diffusion/pipeline_output.py", "repo_id": "diffusers", "token_count": 344 }
221
<jupyter_start><jupyter_text>CAMEL Role-Playing Autonomous Cooperative AgentsThis is a langchain implementation of paper: "CAMEL: Communicative Agents for “Mind” Exploration of Large Scale Language Model Society".Overview:The rapid advancement of conversational and chat-based language models has led to remarkable progr...
langchain/cookbook/camel_role_playing.ipynb/0
{ "file_path": "langchain/cookbook/camel_role_playing.ipynb", "repo_id": "langchain", "token_count": 3106 }
75
// 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/distributed/connection_manager_test.go/0
{ "file_path": "milvus/internal/distributed/connection_manager_test.go", "repo_id": "milvus", "token_count": 3224 }
1,930
from langchain_community.tools.file_management.file_search import ( FileSearchInput, FileSearchTool, ) __all__ = ["FileSearchInput", "FileSearchTool"]
langchain/libs/langchain/langchain/tools/file_management/file_search.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/file_management/file_search.py", "repo_id": "langchain", "token_count": 52 }
554
"""Init composability.""" from llama_index.legacy.composability.base import ComposableGraph from llama_index.legacy.composability.joint_qa_summary import ( QASummaryQueryEngineBuilder, ) __all__ = ["ComposableGraph", "QASummaryQueryEngineBuilder"]
llama_index/llama-index-legacy/llama_index/legacy/composability/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/composability/__init__.py", "repo_id": "llama_index", "token_count": 84 }
1,644
import argparse import torch from diffusers import MotionAdapter def convert_motion_module(original_state_dict): converted_state_dict = {} for k, v in original_state_dict.items(): if "pos_encoder" in k: continue else: converted_state_dict[ k.replace("...
diffusers/scripts/convert_animatediff_motion_module_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_animatediff_motion_module_to_diffusers.py", "repo_id": "diffusers", "token_count": 696 }
216
#ifndef _qdq_6_cuh #define _qdq_6_cuh #include "qdq_util.cuh" #include "../../config.h" #if QMODE_6BIT == 1 // Not implemented #else __forceinline__ __device__ void shuffle_6bit_16 ( uint32_t* q, int stride ) { } __forceinline__ __device__ void dequant_6bit_16 ( const uint32_t q_0, const uint32_...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_6.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_6.cuh", "repo_id": "text-generation-inference", "token_count": 572 }
392
import itertools from dataclasses import dataclass from typing import Optional import pandas as pd import pyarrow as pa import datasets from datasets.table import table_cast @dataclass class PandasConfig(datasets.BuilderConfig): """BuilderConfig for Pandas.""" features: Optional[datasets.Features] = None ...
datasets/src/datasets/packaged_modules/pandas/pandas.py/0
{ "file_path": "datasets/src/datasets/packaged_modules/pandas/pandas.py", "repo_id": "datasets", "token_count": 941 }
145
<!--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/ko/using-diffusers/weighted_prompts.md/0
{ "file_path": "diffusers/docs/source/ko/using-diffusers/weighted_prompts.md", "repo_id": "diffusers", "token_count": 3375 }
204
// 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/init_c.cpp/0
{ "file_path": "milvus/internal/core/src/common/init_c.cpp", "repo_id": "milvus", "token_count": 1251 }
1,656
<jupyter_start><jupyter_text>Gradient`Gradient` allows to fine tune and get completions on LLMs with a simple web API.This notebook goes over how to use Langchain with [Gradient](https://gradient.ai/). Imports<jupyter_code>from langchain.chains import LLMChain from langchain.prompts import PromptTemplate from langchai...
langchain/docs/docs/integrations/llms/gradient.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/gradient.ipynb", "repo_id": "langchain", "token_count": 1191 }
127
"""Test the run collector.""" import uuid from langchain_core.tracers.context import collect_runs from tests.unit_tests.fake.llm import FakeListLLM def test_collect_runs() -> None: llm = FakeListLLM(responses=["hello"]) with collect_runs() as cb: llm.predict("hi") assert cb.traced_runs ...
langchain/libs/core/tests/unit_tests/tracers/test_run_collector.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/tracers/test_run_collector.py", "repo_id": "langchain", "token_count": 202 }
451
import type { CheerioAPI, CheerioOptions, load as LoadT, SelectorType, } from "cheerio"; import { Document } from "@langchain/core/documents"; import { AsyncCaller, AsyncCallerParams, } from "@langchain/core/utils/async_caller"; import { BaseDocumentLoader } from "../base.js"; import type { DocumentLoader }...
langchainjs/langchain/src/document_loaders/web/cheerio.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/web/cheerio.ts", "repo_id": "langchainjs", "token_count": 1453 }
925
# 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 applicabl...
diffusers/src/diffusers/models/autoencoders/vae.py/0
{ "file_path": "diffusers/src/diffusers/models/autoencoders/vae.py", "repo_id": "diffusers", "token_count": 18214 }
234
python_tests()
llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-multi-tenancy-rag/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,855
import sys from functools import partial from operator import itemgetter from typing import ( Any, AsyncIterator, Awaitable, Callable, Dict, Iterator, List, Optional, Sequence, Union, cast, ) from uuid import UUID import pytest from freezegun import freeze_time from pytest_m...
langchain/libs/core/tests/unit_tests/runnables/test_runnable.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/runnables/test_runnable.py", "repo_id": "langchain", "token_count": 80876 }
438
from __future__ import annotations from abc import ABC, abstractmethod from typing import ( TYPE_CHECKING, Any, Dict, Generic, List, Optional, Type, TypeVar, Union, ) from typing_extensions import get_args from langchain_core.messages import AnyMessage, BaseMessage from langchain_...
langchain/libs/core/langchain_core/output_parsers/base.py/0
{ "file_path": "langchain/libs/core/langchain_core/output_parsers/base.py", "repo_id": "langchain", "token_count": 4355 }
433
// 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/proxy/proxy_test.go/0
{ "file_path": "milvus/internal/proxy/proxy_test.go", "repo_id": "milvus", "token_count": 66716 }
1,747
// 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/querycoordv2/balance/balance_test.go/0
{ "file_path": "milvus/internal/querycoordv2/balance/balance_test.go", "repo_id": "milvus", "token_count": 2417 }
2,026
# 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/tests/models/swiftformer/test_modeling_swiftformer.py/0
{ "file_path": "transformers/tests/models/swiftformer/test_modeling_swiftformer.py", "repo_id": "transformers", "token_count": 4796 }
772
"""Test Prediction Guard API wrapper.""" from langchain_community.llms.predictionguard import PredictionGuard def test_predictionguard_call() -> None: """Test valid call to prediction guard.""" llm = PredictionGuard(model="OpenAI-text-davinci-003") output = llm("Say foo:") assert isinstance(output, s...
langchain/libs/community/tests/integration_tests/llms/test_predictionguard.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_predictionguard.py", "repo_id": "langchain", "token_count": 101 }
359
# coding=utf-8 # Copyright 2022 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/whisper/tokenization_whisper_fast.py/0
{ "file_path": "transformers/src/transformers/models/whisper/tokenization_whisper_fast.py", "repo_id": "transformers", "token_count": 13837 }
677
from anthropic_iterative_search import final_chain if __name__ == "__main__": query = ( "Which movie came out first: Oppenheimer, or " "Are You There God It's Me Margaret?" ) print( # noqa: T201 final_chain.with_config(configurable={"chain": "retrieve"}).invoke( {"query...
langchain/templates/anthropic-iterative-search/main.py/0
{ "file_path": "langchain/templates/anthropic-iterative-search/main.py", "repo_id": "langchain", "token_count": 149 }
628
# 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/data2vec/convert_data2vec_text_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/data2vec/convert_data2vec_text_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 3894 }
667
# Output Parsers Output parsers are responsible for taking the output of an LLM and transforming it to a more suitable format. This is very useful when you are asking the LLM to generate any form of structured data. Besides having a large collection of different types of output parsers, one distinguishing benefit of ...
langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/index.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/output_parsers/index.mdx", "repo_id": "langchainjs", "token_count": 170 }
794
# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint. # *Only* converts the UNet, VAE, and Text Encoder. # Does not convert optimizer state or any other thing. import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # ========...
diffusers/scripts/convert_diffusers_to_original_sdxl.py/0
{ "file_path": "diffusers/scripts/convert_diffusers_to_original_sdxl.py", "repo_id": "diffusers", "token_count": 6297 }
217
# coding=utf-8 # Copyright 2022 {{cookiecutter.authors}} 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/lice...
transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/tokenization_{{cookiecutter.lowercase_modelname}}.py/0
{ "file_path": "transformers/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/tokenization_{{cookiecutter.lowercase_modelname}}.py", "repo_id": "transformers", "token_count": 5165 }
712
## 8. Message Stream // TODO remove? #### 8.2 Message Stream Service API ```go type Client interface { CreateChannels(req CreateChannelRequest) (CreateChannelResponse, error) DestroyChannels(req DestroyChannelRequest) error DescribeChannels(req DescribeChannelRequest) (DescribeChannelResponse, error) } ``` - _Cr...
milvus/docs/developer_guides/chap04_message_stream.md/0
{ "file_path": "milvus/docs/developer_guides/chap04_message_stream.md", "repo_id": "milvus", "token_count": 3003 }
1,771
import { test } from "@jest/globals"; import { PromptTemplate } from "@langchain/core/prompts"; import { ChatOpenAI } from "@langchain/openai"; import { StructuredOutputParser, RegexParser, CombiningOutputParser, } from "../index.js"; test("CombiningOutputParser", async () => { const answerParser = Structured...
langchainjs/langchain/src/output_parsers/tests/combining.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/output_parsers/tests/combining.int.test.ts", "repo_id": "langchainjs", "token_count": 403 }
954
[tool.poetry] name = "hybrid-search-weaviate" version = "0.1.0" description = "Improve accuracy and relevance with Weaviate hybrid search" authors = ["Erika Cardenas <erika@weaviate.io>"] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" tiktoken = "^0.5.1" weavia...
langchain/templates/hybrid-search-weaviate/pyproject.toml/0
{ "file_path": "langchain/templates/hybrid-search-weaviate/pyproject.toml", "repo_id": "langchain", "token_count": 349 }
708
<jupyter_start><jupyter_text>Runnable PromptTemplates[](https://colab.research.google.com/github/langchain-ai/langsmith-cookbook/blob/main/hub-examples/runnable-prompt/edit-in-playground.ipynb)When you build a chain using LangChain [runnables](https://python.langchain.com/docs/expression_language), each component is as...
langsmith-cookbook/hub-examples/runnable-prompt/edit-in-playground.ipynb/0
{ "file_path": "langsmith-cookbook/hub-examples/runnable-prompt/edit-in-playground.ipynb", "repo_id": "langsmith-cookbook", "token_count": 1548 }
1,061
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-weather/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-weather/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,443
ann_accuracy: collections: - server: cache_config.cpu_cache_capacity: 16 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: false gpu_resource_config.cache_capacity: 4 gpu_resource_config.search_resources: ...
milvus/tests/benchmark/milvus_benchmark/suites/cpu_accuracy_ann.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/cpu_accuracy_ann.yaml", "repo_id": "milvus", "token_count": 3326 }
2,006
# Copyright (C) 2019-2022 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 law or ag...
milvus/build/docker/builder/cpu/amazonlinux2023/Dockerfile/0
{ "file_path": "milvus/build/docker/builder/cpu/amazonlinux2023/Dockerfile", "repo_id": "milvus", "token_count": 1002 }
1,610
# LlamaIndex Embeddings Integration: Cohere
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-cohere/README.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-cohere/README.md", "repo_id": "llama_index", "token_count": 12 }
1,270
#!/usr/bin/env python # coding=utf-8 # 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-...
transformers/examples/pytorch/language-modeling/run_mlm.py/0
{ "file_path": "transformers/examples/pytorch/language-modeling/run_mlm.py", "repo_id": "transformers", "token_count": 12655 }
530
"use client"; import { ToastContainer, toast } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; import { useChat } from "ai/react"; import { useRef, useState, ReactElement } from "react"; import type { FormEvent } from "react"; import type { AgentStep } from "langchain/schema"; import { ChatMes...
langchain-nextjs-template/components/ChatWindow.tsx/0
{ "file_path": "langchain-nextjs-template/components/ChatWindow.tsx", "repo_id": "langchain-nextjs-template", "token_count": 3078 }
65
"""Init file."""
llama_index/llama-index-legacy/tests/indices/query/query_transform/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/query/query_transform/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,553
package paramtable import ( "github.com/milvus-io/milvus/pkg/config" "github.com/milvus-io/milvus/pkg/util/funcutil" ) type roleConfig struct { Enabled ParamItem `refreshable:"false"` Roles ParamItem `refreshable:"false"` } func (p *roleConfig) init(base *BaseTable) { p.Enabled = ParamItem{ Key: "b...
milvus/pkg/util/paramtable/role_param.go/0
{ "file_path": "milvus/pkg/util/paramtable/role_param.go", "repo_id": "milvus", "token_count": 473 }
1,840
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-kaltura/llama_index/readers/kaltura_esearch/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-kaltura/llama_index/readers/kaltura_esearch/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,398