From 22a8652eccd9023cd41ea0f6924575ce87c28756 Mon Sep 17 00:00:00 2001 From: DreamOfStars Date: Mon, 18 Nov 2024 22:38:48 +0800 Subject: [PATCH 01/17] langchain: add missing punctuation in react_single_input.py (#28161) - [x] **PR title**: "langchain: add missing punctuation in react_single_input.py" - [x] **PR message**: - **Description:** Add missing single quote to line 12: "Invalid Format: Missing 'Action:' after 'Thought:" --- .../langchain/agents/output_parsers/react_single_input.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain/langchain/agents/output_parsers/react_single_input.py b/libs/langchain/langchain/agents/output_parsers/react_single_input.py index f63821588fe5d..b853cb04aaa18 100644 --- a/libs/langchain/langchain/agents/output_parsers/react_single_input.py +++ b/libs/langchain/langchain/agents/output_parsers/react_single_input.py @@ -9,7 +9,7 @@ FINAL_ANSWER_ACTION = "Final Answer:" MISSING_ACTION_AFTER_THOUGHT_ERROR_MESSAGE = ( - "Invalid Format: Missing 'Action:' after 'Thought:" + "Invalid Format: Missing 'Action:' after 'Thought:'" ) MISSING_ACTION_INPUT_AFTER_ACTION_ERROR_MESSAGE = ( "Invalid Format: Missing 'Action Input:' after 'Action:'" From 0c051e57e0f46772f761b443ab2ed9c93fe28036 Mon Sep 17 00:00:00 2001 From: Talha Munir <103119362+devs-talha@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:27:30 +0500 Subject: [PATCH 02/17] docs: fix grammatical error in delegation to sync methods (#28165) ### **Description** Fixed a grammatical error in the documentation section about the delegation to synchronous methods to improve readability and clarity. ### **Issue** No associated issue. ### **Dependencies** No additional dependencies required. ### **Twitter handle** N/A --------- Co-authored-by: ccurme --- docs/docs/concepts/async.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/concepts/async.mdx b/docs/docs/concepts/async.mdx index 2eab35964b3b5..d81c706db243b 100644 --- a/docs/docs/concepts/async.mdx +++ b/docs/docs/concepts/async.mdx @@ -46,7 +46,7 @@ Most popular LangChain integrations implement asynchronous support of their APIs When an asynchronous implementation is not available, LangChain tries to provide a default implementation, even if it incurs a **slight** overhead. -By default, LangChain will delegate the execution of a unimplemented asynchronous methods to the synchronous counterparts. LangChain almost always assumes that the synchronous method should be treated as a blocking operation and should be run in a separate thread. +By default, LangChain will delegate the execution of unimplemented asynchronous methods to the synchronous counterparts. LangChain almost always assumes that the synchronous method should be treated as a blocking operation and should be run in a separate thread. This is done using [asyncio.loop.run_in_executor](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_in_executor) functionality provided by the `asyncio` library. LangChain uses the default executor provided by the `asyncio` library, which lazily initializes a thread pool executor with a default number of threads that is reused in the given event loop. While this strategy incurs a slight overhead due to context switching between threads, it guarantees that every asynchronous method has a default implementation that works out of the box. ## Performance From 093f24ba4d7cac5a0d49fa02e6ed1544aa9b0621 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 18 Nov 2024 09:49:21 -0800 Subject: [PATCH 03/17] docs: standard test update (#28185) --- .../how_to/integrations/standard_tests.ipynb | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/docs/docs/contributing/how_to/integrations/standard_tests.ipynb b/docs/docs/contributing/how_to/integrations/standard_tests.ipynb index 393bf6961c578..c741a76077304 100644 --- a/docs/docs/contributing/how_to/integrations/standard_tests.ipynb +++ b/docs/docs/contributing/how_to/integrations/standard_tests.ipynb @@ -125,7 +125,7 @@ "from langchain_standard_tests.unit_tests import ToolsUnitTests\n", "\n", "\n", - "class ParrotMultiplyToolUnitTests(ToolsUnitTests):\n", + "class TestParrotMultiplyToolUnit(ToolsUnitTests):\n", " @property\n", " def tool_constructor(self) -> Type[ParrotMultiplyTool]:\n", " return ParrotMultiplyTool\n", @@ -159,7 +159,7 @@ "from langchain_standard_tests.integration_tests import ToolsIntegrationTests\n", "\n", "\n", - "class ParrotMultiplyToolIntegrationTests(ToolsIntegrationTests):\n", + "class TestParrotMultiplyToolIntegration(ToolsIntegrationTests):\n", " @property\n", " def tool_constructor(self) -> Type[ParrotMultiplyTool]:\n", " return ParrotMultiplyTool\n", @@ -220,7 +220,7 @@ "from langchain_standard_tests.unit_tests import ChatModelUnitTests\n", "\n", "\n", - "class ChatParrotLinkUnitTests(ChatModelUnitTests):\n", + "class TestChatParrotLinkUnit(ChatModelUnitTests):\n", " @property\n", " def chat_model_class(self) -> Type[ChatParrotLink]:\n", " return ChatParrotLink" @@ -239,7 +239,7 @@ "from langchain_standard_tests.integration_tests import ChatModelIntegrationTests\n", "\n", "\n", - "class TestMistralStandard(ChatModelIntegrationTests):\n", + "class TestChatParrotLinkIntegration(ChatModelIntegrationTests):\n", " @property\n", " def chat_model_class(self) -> Type[ChatParrotLink]:\n", " return ChatParrotLink\n", @@ -258,16 +258,6 @@ "
\n", "Work in progress:\n", "
\n", - " Tools/Toolkits\n", - " TODO" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "
\n", - "
\n", " Retrievers\n", " TODO" ] From c26b3575f835d2de5d4fa67ae697e36efc4d71c6 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 18 Nov 2024 09:58:07 -0800 Subject: [PATCH 04/17] docs: community integration guide clarification (#28186) --- docs/docs/contributing/how_to/integrations/community.mdx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/docs/contributing/how_to/integrations/community.mdx b/docs/docs/contributing/how_to/integrations/community.mdx index 0b965b0e4c997..a33ae002cd0d4 100644 --- a/docs/docs/contributing/how_to/integrations/community.mdx +++ b/docs/docs/contributing/how_to/integrations/community.mdx @@ -1,10 +1,13 @@ -## How to add a community integration (deprecated) +## How to add a community integration (deprecated guide) :::danger We are no longer accepting new community integrations. Please see the [main integration guide](./index.mdx) for more information on contributing new -integrations. +integrations. + +Note that `langchain-community` is **not** deprecated. Only +the process for adding new community integrations is deprecated. ::: From a1db744b2098de2935e94bcf9681c6e488c53b6c Mon Sep 17 00:00:00 2001 From: ccurme Date: Mon, 18 Nov 2024 13:34:35 -0500 Subject: [PATCH 05/17] docs: add component tabs to integration landing pages (#28142) - Add to embedding model tabs - Add tabs for vector stores - Add "hello world" examples in integration landing pages using tabs --- docs/docs/how_to/embed_text.mdx | 82 +------------- docs/docs/integrations/chat/index.mdx | 8 ++ .../text_embedding/azureopenai.ipynb | 8 +- .../integrations/text_embedding/bedrock.ipynb | 4 +- .../integrations/text_embedding/index.mdx | 8 ++ docs/docs/integrations/vectorstores/index.mdx | 14 ++- docs/src/theme/ChatModelTabs.js | 2 +- docs/src/theme/EmbeddingTabs.js | 102 +++++++++++++++++- docs/src/theme/FeatureTables.js | 2 +- docs/src/theme/VectorStoreTabs.js | 92 ++++++++++++++++ 10 files changed, 232 insertions(+), 90 deletions(-) create mode 100644 docs/src/theme/VectorStoreTabs.js diff --git a/docs/docs/how_to/embed_text.mdx b/docs/docs/how_to/embed_text.mdx index 2450e99440c27..0c636fec3e7a0 100644 --- a/docs/docs/how_to/embed_text.mdx +++ b/docs/docs/how_to/embed_text.mdx @@ -15,87 +15,9 @@ The base Embeddings class in LangChain provides two methods: one for embedding d ### Setup -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; +import EmbeddingTabs from "@theme/EmbeddingTabs"; - - -To start we'll need to install the OpenAI partner package: - -```bash -pip install langchain-openai -``` - -Accessing the API requires an API key, which you can get by creating an account and heading [here](https://platform.openai.com/account/api-keys). Once we have a key we'll want to set it as an environment variable by running: - -```bash -export OPENAI_API_KEY="..." -``` - -If you'd prefer not to set an environment variable you can pass the key in directly via the `api_key` named parameter when initiating the OpenAI LLM class: - -```python -from langchain_openai import OpenAIEmbeddings - -embeddings_model = OpenAIEmbeddings(api_key="...") -``` - -Otherwise you can initialize without any params: -```python -from langchain_openai import OpenAIEmbeddings - -embeddings_model = OpenAIEmbeddings() -``` - - - - -To start we'll need to install the Cohere SDK package: - -```bash -pip install langchain-cohere -``` - -Accessing the API requires an API key, which you can get by creating an account and heading [here](https://dashboard.cohere.com/api-keys). Once we have a key we'll want to set it as an environment variable by running: - -```shell -export COHERE_API_KEY="..." -``` - -If you'd prefer not to set an environment variable you can pass the key in directly via the `cohere_api_key` named parameter when initiating the Cohere LLM class: - -```python -from langchain_cohere import CohereEmbeddings - -embeddings_model = CohereEmbeddings(cohere_api_key="...", model='embed-english-v3.0') -``` - -Otherwise you can initialize simply as shown below: -```python -from langchain_cohere import CohereEmbeddings - -embeddings_model = CohereEmbeddings(model='embed-english-v3.0') -``` -Do note that it is mandatory to pass the model parameter while initializing the CohereEmbeddings class. - - - - -To start we'll need to install the Hugging Face partner package: - -```bash -pip install langchain-huggingface -``` - -You can then load any [Sentence Transformers model](https://huggingface.co/models?library=sentence-transformers) from the Hugging Face Hub. - -```python -from langchain_huggingface import HuggingFaceEmbeddings - -embeddings_model = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2") -``` - - + ### `embed_documents` #### Embed list of texts diff --git a/docs/docs/integrations/chat/index.mdx b/docs/docs/integrations/chat/index.mdx index e2b0be6da4dda..537cdc2c11a37 100644 --- a/docs/docs/integrations/chat/index.mdx +++ b/docs/docs/integrations/chat/index.mdx @@ -15,6 +15,14 @@ If you'd like to contribute an integration, see [Contributing integrations](/doc ::: +import ChatModelTabs from "@theme/ChatModelTabs"; + + + +```python +model.invoke("Hello, world!") +``` + ## Featured Providers :::info diff --git a/docs/docs/integrations/text_embedding/azureopenai.ipynb b/docs/docs/integrations/text_embedding/azureopenai.ipynb index 7f5281e21e9e5..916132c6f3e43 100644 --- a/docs/docs/integrations/text_embedding/azureopenai.ipynb +++ b/docs/docs/integrations/text_embedding/azureopenai.ipynb @@ -45,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "36521c2a", "metadata": {}, "outputs": [], @@ -53,8 +53,10 @@ "import getpass\n", "import os\n", "\n", - "if not os.getenv(\"OPENAI_API_KEY\"):\n", - " os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"Enter your AzureOpenAI API key: \")" + "if not os.getenv(\"AZURE_OPENAI_API_KEY\"):\n", + " os.environ[\"AZURE_OPENAI_API_KEY\"] = getpass.getpass(\n", + " \"Enter your AzureOpenAI API key: \"\n", + " )" ] }, { diff --git a/docs/docs/integrations/text_embedding/bedrock.ipynb b/docs/docs/integrations/text_embedding/bedrock.ipynb index 3c4768507827c..b559621f29104 100644 --- a/docs/docs/integrations/text_embedding/bedrock.ipynb +++ b/docs/docs/integrations/text_embedding/bedrock.ipynb @@ -31,12 +31,12 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "282239c8-e03a-4abc-86c1-ca6120231a20", "metadata": {}, "outputs": [], "source": [ - "from langchain_community.embeddings import BedrockEmbeddings\n", + "from langchain_aws import BedrockEmbeddings\n", "\n", "embeddings = BedrockEmbeddings(\n", " credentials_profile_name=\"bedrock-admin\", region_name=\"us-east-1\"\n", diff --git a/docs/docs/integrations/text_embedding/index.mdx b/docs/docs/integrations/text_embedding/index.mdx index fe2a627192139..169480565122b 100644 --- a/docs/docs/integrations/text_embedding/index.mdx +++ b/docs/docs/integrations/text_embedding/index.mdx @@ -11,6 +11,14 @@ import { CategoryTable, IndexTable } from "@theme/FeatureTables"; This page documents integrations with various model providers that allow you to use embeddings in LangChain. +import EmbeddingTabs from "@theme/EmbeddingTabs"; + + + +```python +embeddings.embed_query("Hello, world!") +``` + ## All embedding models diff --git a/docs/docs/integrations/vectorstores/index.mdx b/docs/docs/integrations/vectorstores/index.mdx index 8b276057dad21..c213d968ee3e2 100644 --- a/docs/docs/integrations/vectorstores/index.mdx +++ b/docs/docs/integrations/vectorstores/index.mdx @@ -3,12 +3,24 @@ sidebar_position: 0 sidebar_class_name: hidden --- -# Vectorstores +# Vector stores import { CategoryTable, IndexTable } from "@theme/FeatureTables"; A [vector store](/docs/concepts/vectorstores) stores [embedded](/docs/concepts/embedding_models) data and performs similarity search. +**Select embedding model:** + +import EmbeddingTabs from "@theme/EmbeddingTabs"; + + + +**Select vector store:** + +import VectorStoreTabs from "@theme/VectorStoreTabs"; + + + ## All Vectorstores diff --git a/docs/src/theme/ChatModelTabs.js b/docs/src/theme/ChatModelTabs.js index 9d27a9a44a135..162723942aab4 100644 --- a/docs/src/theme/ChatModelTabs.js +++ b/docs/src/theme/ChatModelTabs.js @@ -114,7 +114,7 @@ export default function ChatModelTabs(props) { value: "Google", label: "Google", text: `from langchain_google_vertexai import ChatVertexAI\n\n${llmVarName} = ChatVertexAI(${googleParamsOrDefault})`, - apiKeyName: "GOOGLE_API_KEY", + apiKeyText: "# Ensure your VertexAI credentials are configured", packageName: "langchain-google-vertexai", default: false, shouldHide: hideGoogle, diff --git a/docs/src/theme/EmbeddingTabs.js b/docs/src/theme/EmbeddingTabs.js index 7ad62a515ad89..3c4d1d814fd15 100644 --- a/docs/src/theme/EmbeddingTabs.js +++ b/docs/src/theme/EmbeddingTabs.js @@ -7,15 +7,41 @@ export default function EmbeddingTabs(props) { const { openaiParams, hideOpenai, + azureOpenaiParams, + hideAzureOpenai, + googleParams, + hideGoogle, + awsParams, + hideAws, huggingFaceParams, hideHuggingFace, + ollamaParams, + hideOllama, + cohereParams, + hideCohere, + mistralParams, + hideMistral, + nomicParams, + hideNomic, + nvidiaParams, + hideNvidia, fakeEmbeddingParams, hideFakeEmbedding, customVarName, } = props; const openAIParamsOrDefault = openaiParams ?? `model="text-embedding-3-large"`; + const azureParamsOrDefault = + azureOpenaiParams ?? + `\n azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],\n azure_deployment=os.environ["AZURE_OPENAI_DEPLOYMENT_NAME"],\n openai_api_version=os.environ["AZURE_OPENAI_API_VERSION"],\n`; + const googleParamsOrDefault = googleParams ?? `model="text-embedding-004"`; + const awsParamsOrDefault = awsParams ?? `model_id="amazon.titan-embed-text-v2:0"`; const huggingFaceParamsOrDefault = huggingFaceParams ?? `model="sentence-transformers/all-mpnet-base-v2"`; + const ollamaParamsOrDefault = ollamaParams ?? `model="llama3"`; + const cohereParamsOrDefault = cohereParams ?? `model="embed-english-v3.0"`; + const mistralParamsOrDefault = mistralParams ?? `model="mistral-embed"`; + const nomicsParamsOrDefault = nomicParams ?? `model="nomic-embed-text-v1.5"`; + const nvidiaParamsOrDefault = nvidiaParams ?? `model="NV-Embed-QA"`; const fakeEmbeddingParamsOrDefault = fakeEmbeddingParams ?? `size=4096`; const embeddingVarName = customVarName ?? "embeddings"; @@ -30,6 +56,33 @@ export default function EmbeddingTabs(props) { default: true, shouldHide: hideOpenai, }, + { + value: "Azure", + label: "Azure", + text: `from langchain_openai import AzureOpenAIEmbeddings\n\n${embeddingVarName} = AzureOpenAIEmbeddings(${azureParamsOrDefault})`, + apiKeyName: "AZURE_OPENAI_API_KEY", + packageName: "langchain-openai", + default: false, + shouldHide: hideAzureOpenai, + }, + { + value: "Google", + label: "Google", + text: `from langchain_google_vertexai import VertexAIEmbeddings\n\n${embeddingVarName} = VertexAIEmbeddings(${googleParamsOrDefault})`, + apiKeyName: undefined, + packageName: "langchain-google-vertexai", + default: false, + shouldHide: hideGoogle, + }, + { + value: "AWS", + label: "AWS", + text: `from langchain_aws import BedrockEmbeddings\n\n${embeddingVarName} = BedrockEmbeddings(${awsParamsOrDefault})`, + apiKeyName: undefined, + packageName: "langchain-aws", + default: false, + shouldHide: hideAws, + }, { value: "HuggingFace", label: "HuggingFace", @@ -40,8 +93,53 @@ export default function EmbeddingTabs(props) { shouldHide: hideHuggingFace, }, { - value: "Fake Embedding", - label: "Fake Embedding", + value: "Ollama", + label: "Ollama", + text: `from langchain_ollama import OllamaEmbeddings\n\n${embeddingVarName} = OllamaEmbeddings(${ollamaParamsOrDefault})`, + apiKeyName: undefined, + packageName: "langchain-ollama", + default: false, + shouldHide: hideOllama, + }, + { + value: "Cohere", + label: "Cohere", + text: `from langchain_cohere import CohereEmbeddings\n\n${embeddingVarName} = CohereEmbeddings(${cohereParamsOrDefault})`, + apiKeyName: "COHERE_API_KEY", + packageName: "langchain-cohere", + default: false, + shouldHide: hideCohere, + }, + { + value: "MistralAI", + label: "MistralAI", + text: `from langchain_mistralai import MistralAIEmbeddings\n\n${embeddingVarName} = MistralAIEmbeddings(${mistralParamsOrDefault})`, + apiKeyName: "MISTRALAI_API_KEY", + packageName: "langchain-mistralai", + default: false, + shouldHide: hideMistral, + }, + { + value: "Nomic", + label: "Nomic", + text: `from langchain_nomic import NomicEmbeddings\n\n${embeddingVarName} = NomicEmbeddings(${nomicsParamsOrDefault})`, + apiKeyName: "NOMIC_API_KEY", + packageName: "langchain-nomic", + default: false, + shouldHide: hideNomic, + }, + { + value: "NVIDIA", + label: "NVIDIA", + text: `from langchain_nvidia_ai_endpoints import NVIDIAEmbeddings\n\n${embeddingVarName} = NVIDIAEmbeddings(${nvidiaParamsOrDefault})`, + apiKeyName: "NVIDIA_API_KEY", + packageName: "langchain-nvidia-ai-endpoints", + default: false, + shouldHide: hideNvidia, + }, + { + value: "Fake", + label: "Fake", text: `from langchain_core.embeddings import FakeEmbeddings\n\n${embeddingVarName} = FakeEmbeddings(${fakeEmbeddingParamsOrDefault})`, apiKeyName: undefined, packageName: "langchain-core", diff --git a/docs/src/theme/FeatureTables.js b/docs/src/theme/FeatureTables.js index a7b31cdc2910e..afa27742aaee9 100644 --- a/docs/src/theme/FeatureTables.js +++ b/docs/src/theme/FeatureTables.js @@ -406,7 +406,7 @@ const FEATURE_TABLES = { }, { name: "NVIDIA", - link: "NVIDIAEmbeddings", + link: "nvidia_ai_endpoints", package: "langchain-nvidia", apiLink: "https://python.langchain.com/api_reference/nvidia_ai_endpoints/embeddings/langchain_nvidia_ai_endpoints.embeddings.NVIDIAEmbeddings.html" }, diff --git a/docs/src/theme/VectorStoreTabs.js b/docs/src/theme/VectorStoreTabs.js new file mode 100644 index 0000000000000..52c20fba5158d --- /dev/null +++ b/docs/src/theme/VectorStoreTabs.js @@ -0,0 +1,92 @@ +import React from "react"; +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import CodeBlock from "@theme-original/CodeBlock"; + +export default function VectorStoreTabs(props) { + const { customVarName } = props; + + const vectorStoreVarName = customVarName ?? "vector_store"; + + const tabItems = [ + { + value: "In-memory", + label: "In-memory", + text: `from langchain_core.vector_stores import InMemoryVectorStore\n\n${vectorStoreVarName} = InMemoryVectorStore(embeddings)`, + packageName: "langchain-core", + default: true, + }, + { + value: "AstraDB", + label: "AstraDB", + text: `from langchain_astradb import AstraDBVectorStore\n\n${vectorStoreVarName} = AstraDBVectorStore(\n embedding=embeddings,\n api_endpoint=ASTRA_DB_API_ENDPOINT,\n collection_name="astra_vector_langchain",\n token=ASTRA_DB_APPLICATION_TOKEN,\n namespace=ASTRA_DB_NAMESPACE,\n)`, + packageName: "langchain-astradb", + default: false, + }, + { + value: "Chroma", + label: "Chroma", + text: `from langchain_chroma import Chroma\n\n${vectorStoreVarName} = Chroma(embedding_function=embeddings)`, + packageName: "langchain-chroma", + default: false, + }, + { + value: "FAISS", + label: "FAISS", + text: `from langchain_community.vectorstores import FAISS\n\n${vectorStoreVarName} = FAISS(embedding_function=embeddings)`, + packageName: "langchain-community", + default: false, + }, + { + value: "Milvus", + label: "Milvus", + text: `from langchain_milvus import Milvus\n\n${vectorStoreVarName} = Milvus(embedding_function=embeddings)`, + packageName: "langchain-milvus", + default: false, + }, + { + value: "MongoDB", + label: "MongoDB", + text: `from langchain_mongodb import MongoDBAtlasVectorSearch\n\n${vectorStoreVarName} = MongoDBAtlasVectorSearch(\n embedding=embeddings,\n collection=MONGODB_COLLECTION,\n index_name=ATLAS_VECTOR_SEARCH_INDEX_NAME,\n relevance_score_fn="cosine",\n)`, + packageName: "langchain-mongodb", + default: false, + }, + { + value: "PGVector", + label: "PGVector", + text: `from langchain_postgres import PGVector\n\n${vectorStoreVarName} = PGVector(\n embedding=embeddings,\n collection_name="my_docs",\n connection="postgresql+psycopg://...",\n)`, + packageName: "langchain-postgres", + default: false, + }, + { + value: "Pinecone", + label: "Pinecone", + text: `from langchain_pinecone import PineconeVectorStore\nfrom pinecone import Pinecone\n\npc = Pinecone(api_key=...)\nindex = pc.Index(index_name)\n\n${vectorStoreVarName} = PineconeVectorStore(embedding=embeddings, index=index)`, + packageName: "langchain-pinecone", + default: false, + }, + { + value: "Qdrant", + label: "Qdrant", + text: `from langchain_qdrant import QdrantVectorStore\nfrom qdrant_client import QdrantClient\n\nclient = QdrantClient(":memory:")\n${vectorStoreVarName} = QdrantVectorStore(\n client=client,\n collection_name="test",\n embedding=embeddings,\n)`, + packageName: "langchain-qdrant", + default: false, + }, + ]; + + return ( + + {tabItems.map((tabItem) => ( + + {`pip install -qU ${tabItem.packageName}`} + {tabItem.text} + + ))} + + ); +} From 3a63055ce239ceacc70fcdaa2983c5a2222cf9ff Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Mon, 18 Nov 2024 14:35:10 -0500 Subject: [PATCH 06/17] docs[patch]: Add missing link to streaming concepts page (#28189) Add missing streaming concept --- docs/docs/concepts/index.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs/concepts/index.mdx b/docs/docs/concepts/index.mdx index c53cc21ce21f1..9b7272643b49e 100644 --- a/docs/docs/concepts/index.mdx +++ b/docs/docs/concepts/index.mdx @@ -22,6 +22,7 @@ The conceptual guide does not cover step-by-step instructions or specific implem - **[Memory](https://langchain-ai.github.io/langgraph/concepts/memory/)**: Information about a conversation that is persisted so that it can be used in future conversations. - **[Multimodality](/docs/concepts/multimodality)**: The ability to work with data that comes in different forms, such as text, audio, images, and video. - **[Runnable interface](/docs/concepts/runnables)**: The base abstraction that many LangChain components and the LangChain Expression Language are built on. +- **[Streaming](/docs/concepts/streaming)**: LangChain streaming APIs for surfacing results as they are generated. - **[LangChain Expression Language (LCEL)](/docs/concepts/lcel)**: A syntax for orchestrating LangChain components. Most useful for simpler applications. - **[Document loaders](/docs/concepts/document_loaders)**: Load a source as a list of documents. - **[Retrieval](/docs/concepts/retrieval)**: Information retrieval systems can retrieve structured or unstructured data from a datasource in response to a query. From 6dfea7e508eb7c789dc7bb7d0b8a9042856beaf1 Mon Sep 17 00:00:00 2001 From: Mahdi Massahi <59474388+Mahdi-Massahi@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:46:47 +0100 Subject: [PATCH 07/17] docs: fixed a typo (#28191) **Description**: removed the redundant phrase (typo) --- docs/docs/tutorials/llm_chain.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/tutorials/llm_chain.ipynb b/docs/docs/tutorials/llm_chain.ipynb index fccc2c6cd9fc1..ea1a8ae0288f2 100644 --- a/docs/docs/tutorials/llm_chain.ipynb +++ b/docs/docs/tutorials/llm_chain.ipynb @@ -318,7 +318,7 @@ "source": [ "## Conclusion\n", "\n", - "That's it! In this tutorial you've learned how to create your first simple LLM application. You've learned how to work with language models, how to how to create a prompt template, and how to get great observability into chains you create with LangSmith.\n", + "That's it! In this tutorial you've learned how to create your first simple LLM application. You've learned how to work with language models, how to create a prompt template, and how to get great observability into chains you create with LangSmith.\n", "\n", "This just scratches the surface of what you will want to learn to become a proficient AI Engineer. Luckily - we've got a lot of other resources!\n", "\n", From 018f4102f4c7e088f770de2972c8ae36760294e8 Mon Sep 17 00:00:00 2001 From: ccurme Date: Mon, 18 Nov 2024 16:00:20 -0500 Subject: [PATCH 08/17] docs: fix embeddings tabs (#28193) - Update fake embeddings to deterministic fake embeddings - Fix indentation --- docs/src/theme/EmbeddingTabs.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/src/theme/EmbeddingTabs.js b/docs/src/theme/EmbeddingTabs.js index 3c4d1d814fd15..7e1012baec109 100644 --- a/docs/src/theme/EmbeddingTabs.js +++ b/docs/src/theme/EmbeddingTabs.js @@ -140,7 +140,7 @@ export default function EmbeddingTabs(props) { { value: "Fake", label: "Fake", - text: `from langchain_core.embeddings import FakeEmbeddings\n\n${embeddingVarName} = FakeEmbeddings(${fakeEmbeddingParamsOrDefault})`, + text: `from langchain_core.embeddings import DeterministicFakeEmbedding\n\n${embeddingVarName} = DeterministicFakeEmbedding(${fakeEmbeddingParamsOrDefault})`, apiKeyName: undefined, packageName: "langchain-core", default: false, @@ -153,9 +153,7 @@ export default function EmbeddingTabs(props) { {tabItems .filter((tabItem) => !tabItem.shouldHide) .map((tabItem) => { - const apiKeyText = tabItem.apiKeyName ? `import getpass - - os.environ["${tabItem.apiKeyName}"] = getpass.getpass()` : ''; + const apiKeyText = tabItem.apiKeyName ? `import getpass\n\nos.environ["${tabItem.apiKeyName}"] = getpass.getpass()` : ''; return ( Date: Mon, 18 Nov 2024 14:09:16 -0800 Subject: [PATCH 09/17] docs: efficient rebuild (#28195) if you run `make build start` in one tab, then start editing files, you can efficient rebuild notebooks with `make generate-files md-sync render` --- docs/Makefile | 2 +- docs/scripts/notebook_convert.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index fabed9f041ac5..a3c41260e3dd0 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -38,7 +38,7 @@ install-py-deps: generate-files: mkdir -p $(INTERMEDIATE_DIR) - cp -r $(SOURCE_DIR)/* $(INTERMEDIATE_DIR) + cp -rp $(SOURCE_DIR)/* $(INTERMEDIATE_DIR) $(PYTHON) scripts/tool_feat_table.py $(INTERMEDIATE_DIR) diff --git a/docs/scripts/notebook_convert.py b/docs/scripts/notebook_convert.py index 02b83f8032839..429734f115817 100644 --- a/docs/scripts/notebook_convert.py +++ b/docs/scripts/notebook_convert.py @@ -184,7 +184,18 @@ def _convert_notebook( source_paths_stripped = [p.strip() for p in source_path_strs] source_paths = [intermediate_docs_dir / p for p in source_paths_stripped if p] else: - source_paths = intermediate_docs_dir.glob("**/*.ipynb") + original_paths = list(intermediate_docs_dir.glob("**/*.ipynb")) + # exclude files that exist in output directory and are newer + relative_paths = [p.relative_to(intermediate_docs_dir) for p in original_paths] + out_paths = [ + output_docs_dir / p.parent / (p.stem + ".md") for p in relative_paths + ] + source_paths = [ + p + for p, o in zip(original_paths, out_paths) + if not o.exists() or o.stat().st_mtime < p.stat().st_mtime + ] + print(f"rebuilding {len(source_paths)}/{len(relative_paths)} notebooks") with multiprocessing.Pool() as pool: pool.map( From d9d689572a23b590b1134d30740b50b5e553c8ef Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 18 Nov 2024 15:54:38 -0800 Subject: [PATCH 10/17] openai: release 0.2.9, o1 streaming (#28197) --- .../langchain_openai/chat_models/base.py | 3 - libs/partners/openai/poetry.lock | 144 +++++++++--------- libs/partners/openai/pyproject.toml | 2 +- 3 files changed, 73 insertions(+), 76 deletions(-) diff --git a/libs/partners/openai/langchain_openai/chat_models/base.py b/libs/partners/openai/langchain_openai/chat_models/base.py index 7d69b27fb1bc8..94c96202b07f6 100644 --- a/libs/partners/openai/langchain_openai/chat_models/base.py +++ b/libs/partners/openai/langchain_openai/chat_models/base.py @@ -993,9 +993,6 @@ def _should_stream( # TODO: Add support for streaming with Pydantic response_format. warnings.warn("Streaming with Pydantic response_format not yet supported.") return False - if self.model_name is not None and self.model_name.startswith("o1"): - # TODO: Add support for streaming with o1 once supported. - return False return super()._should_stream( async_api=async_api, run_manager=run_manager, **kwargs diff --git a/libs/partners/openai/poetry.lock b/libs/partners/openai/poetry.lock index 17cd5f497af25..118f8dc31d35c 100644 --- a/libs/partners/openai/poetry.lock +++ b/libs/partners/openai/poetry.lock @@ -188,73 +188,73 @@ files = [ [[package]] name = "coverage" -version = "7.6.4" +version = "7.6.7" description = "Code coverage measurement for Python" optional = false python-versions = ">=3.9" files = [ - {file = "coverage-7.6.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5f8ae553cba74085db385d489c7a792ad66f7f9ba2ee85bfa508aeb84cf0ba07"}, - {file = "coverage-7.6.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8165b796df0bd42e10527a3f493c592ba494f16ef3c8b531288e3d0d72c1f6f0"}, - {file = "coverage-7.6.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c7c8b95bf47db6d19096a5e052ffca0a05f335bc63cef281a6e8fe864d450a72"}, - {file = "coverage-7.6.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8ed9281d1b52628e81393f5eaee24a45cbd64965f41857559c2b7ff19385df51"}, - {file = "coverage-7.6.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0809082ee480bb8f7416507538243c8863ac74fd8a5d2485c46f0f7499f2b491"}, - {file = "coverage-7.6.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d541423cdd416b78626b55f123412fcf979d22a2c39fce251b350de38c15c15b"}, - {file = "coverage-7.6.4-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:58809e238a8a12a625c70450b48e8767cff9eb67c62e6154a642b21ddf79baea"}, - {file = "coverage-7.6.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c9b8e184898ed014884ca84c70562b4a82cbc63b044d366fedc68bc2b2f3394a"}, - {file = "coverage-7.6.4-cp310-cp310-win32.whl", hash = "sha256:6bd818b7ea14bc6e1f06e241e8234508b21edf1b242d49831831a9450e2f35fa"}, - {file = "coverage-7.6.4-cp310-cp310-win_amd64.whl", hash = "sha256:06babbb8f4e74b063dbaeb74ad68dfce9186c595a15f11f5d5683f748fa1d172"}, - {file = "coverage-7.6.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:73d2b73584446e66ee633eaad1a56aad577c077f46c35ca3283cd687b7715b0b"}, - {file = "coverage-7.6.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:51b44306032045b383a7a8a2c13878de375117946d68dcb54308111f39775a25"}, - {file = "coverage-7.6.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0b3fb02fe73bed561fa12d279a417b432e5b50fe03e8d663d61b3d5990f29546"}, - {file = "coverage-7.6.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ed8fe9189d2beb6edc14d3ad19800626e1d9f2d975e436f84e19efb7fa19469b"}, - {file = "coverage-7.6.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b369ead6527d025a0fe7bd3864e46dbee3aa8f652d48df6174f8d0bac9e26e0e"}, - {file = "coverage-7.6.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:ade3ca1e5f0ff46b678b66201f7ff477e8fa11fb537f3b55c3f0568fbfe6e718"}, - {file = "coverage-7.6.4-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:27fb4a050aaf18772db513091c9c13f6cb94ed40eacdef8dad8411d92d9992db"}, - {file = "coverage-7.6.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:4f704f0998911abf728a7783799444fcbbe8261c4a6c166f667937ae6a8aa522"}, - {file = "coverage-7.6.4-cp311-cp311-win32.whl", hash = "sha256:29155cd511ee058e260db648b6182c419422a0d2e9a4fa44501898cf918866cf"}, - {file = "coverage-7.6.4-cp311-cp311-win_amd64.whl", hash = "sha256:8902dd6a30173d4ef09954bfcb24b5d7b5190cf14a43170e386979651e09ba19"}, - {file = "coverage-7.6.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:12394842a3a8affa3ba62b0d4ab7e9e210c5e366fbac3e8b2a68636fb19892c2"}, - {file = "coverage-7.6.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2b6b4c83d8e8ea79f27ab80778c19bc037759aea298da4b56621f4474ffeb117"}, - {file = "coverage-7.6.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d5b8007f81b88696d06f7df0cb9af0d3b835fe0c8dbf489bad70b45f0e45613"}, - {file = "coverage-7.6.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b57b768feb866f44eeed9f46975f3d6406380275c5ddfe22f531a2bf187eda27"}, - {file = "coverage-7.6.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5915fcdec0e54ee229926868e9b08586376cae1f5faa9bbaf8faf3561b393d52"}, - {file = "coverage-7.6.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0b58c672d14f16ed92a48db984612f5ce3836ae7d72cdd161001cc54512571f2"}, - {file = "coverage-7.6.4-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:2fdef0d83a2d08d69b1f2210a93c416d54e14d9eb398f6ab2f0a209433db19e1"}, - {file = "coverage-7.6.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8cf717ee42012be8c0cb205dbbf18ffa9003c4cbf4ad078db47b95e10748eec5"}, - {file = "coverage-7.6.4-cp312-cp312-win32.whl", hash = "sha256:7bb92c539a624cf86296dd0c68cd5cc286c9eef2d0c3b8b192b604ce9de20a17"}, - {file = "coverage-7.6.4-cp312-cp312-win_amd64.whl", hash = "sha256:1032e178b76a4e2b5b32e19d0fd0abbce4b58e77a1ca695820d10e491fa32b08"}, - {file = "coverage-7.6.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:023bf8ee3ec6d35af9c1c6ccc1d18fa69afa1cb29eaac57cb064dbb262a517f9"}, - {file = "coverage-7.6.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:b0ac3d42cb51c4b12df9c5f0dd2f13a4f24f01943627120ec4d293c9181219ba"}, - {file = "coverage-7.6.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f8fe4984b431f8621ca53d9380901f62bfb54ff759a1348cd140490ada7b693c"}, - {file = "coverage-7.6.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5fbd612f8a091954a0c8dd4c0b571b973487277d26476f8480bfa4b2a65b5d06"}, - {file = "coverage-7.6.4-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dacbc52de979f2823a819571f2e3a350a7e36b8cb7484cdb1e289bceaf35305f"}, - {file = "coverage-7.6.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:dab4d16dfef34b185032580e2f2f89253d302facba093d5fa9dbe04f569c4f4b"}, - {file = "coverage-7.6.4-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:862264b12ebb65ad8d863d51f17758b1684560b66ab02770d4f0baf2ff75da21"}, - {file = "coverage-7.6.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5beb1ee382ad32afe424097de57134175fea3faf847b9af002cc7895be4e2a5a"}, - {file = "coverage-7.6.4-cp313-cp313-win32.whl", hash = "sha256:bf20494da9653f6410213424f5f8ad0ed885e01f7e8e59811f572bdb20b8972e"}, - {file = "coverage-7.6.4-cp313-cp313-win_amd64.whl", hash = "sha256:182e6cd5c040cec0a1c8d415a87b67ed01193ed9ad458ee427741c7d8513d963"}, - {file = "coverage-7.6.4-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:a181e99301a0ae128493a24cfe5cfb5b488c4e0bf2f8702091473d033494d04f"}, - {file = "coverage-7.6.4-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:df57bdbeffe694e7842092c5e2e0bc80fff7f43379d465f932ef36f027179806"}, - {file = "coverage-7.6.4-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0bcd1069e710600e8e4cf27f65c90c7843fa8edfb4520fb0ccb88894cad08b11"}, - {file = "coverage-7.6.4-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:99b41d18e6b2a48ba949418db48159d7a2e81c5cc290fc934b7d2380515bd0e3"}, - {file = "coverage-7.6.4-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a6b1e54712ba3474f34b7ef7a41e65bd9037ad47916ccb1cc78769bae324c01a"}, - {file = "coverage-7.6.4-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:53d202fd109416ce011578f321460795abfe10bb901b883cafd9b3ef851bacfc"}, - {file = "coverage-7.6.4-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:c48167910a8f644671de9f2083a23630fbf7a1cb70ce939440cd3328e0919f70"}, - {file = "coverage-7.6.4-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:cc8ff50b50ce532de2fa7a7daae9dd12f0a699bfcd47f20945364e5c31799fef"}, - {file = "coverage-7.6.4-cp313-cp313t-win32.whl", hash = "sha256:b8d3a03d9bfcaf5b0141d07a88456bb6a4c3ce55c080712fec8418ef3610230e"}, - {file = "coverage-7.6.4-cp313-cp313t-win_amd64.whl", hash = "sha256:f3ddf056d3ebcf6ce47bdaf56142af51bb7fad09e4af310241e9db7a3a8022e1"}, - {file = "coverage-7.6.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9cb7fa111d21a6b55cbf633039f7bc2749e74932e3aa7cb7333f675a58a58bf3"}, - {file = "coverage-7.6.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:11a223a14e91a4693d2d0755c7a043db43d96a7450b4f356d506c2562c48642c"}, - {file = "coverage-7.6.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a413a096c4cbac202433c850ee43fa326d2e871b24554da8327b01632673a076"}, - {file = "coverage-7.6.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:00a1d69c112ff5149cabe60d2e2ee948752c975d95f1e1096742e6077affd376"}, - {file = "coverage-7.6.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f76846299ba5c54d12c91d776d9605ae33f8ae2b9d1d3c3703cf2db1a67f2c0"}, - {file = "coverage-7.6.4-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:fe439416eb6380de434886b00c859304338f8b19f6f54811984f3420a2e03858"}, - {file = "coverage-7.6.4-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:0294ca37f1ba500667b1aef631e48d875ced93ad5e06fa665a3295bdd1d95111"}, - {file = "coverage-7.6.4-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:6f01ba56b1c0e9d149f9ac85a2f999724895229eb36bd997b61e62999e9b0901"}, - {file = "coverage-7.6.4-cp39-cp39-win32.whl", hash = "sha256:bc66f0bf1d7730a17430a50163bb264ba9ded56739112368ba985ddaa9c3bd09"}, - {file = "coverage-7.6.4-cp39-cp39-win_amd64.whl", hash = "sha256:c481b47f6b5845064c65a7bc78bc0860e635a9b055af0df46fdf1c58cebf8e8f"}, - {file = "coverage-7.6.4-pp39.pp310-none-any.whl", hash = "sha256:3c65d37f3a9ebb703e710befdc489a38683a5b152242664b973a7b7b22348a4e"}, - {file = "coverage-7.6.4.tar.gz", hash = "sha256:29fc0f17b1d3fea332f8001d4558f8214af7f1d87a345f3a133c901d60347c73"}, + {file = "coverage-7.6.7-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:108bb458827765d538abcbf8288599fee07d2743357bdd9b9dad456c287e121e"}, + {file = "coverage-7.6.7-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c973b2fe4dc445cb865ab369df7521df9c27bf40715c837a113edaa2aa9faf45"}, + {file = "coverage-7.6.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3c6b24007c4bcd0b19fac25763a7cac5035c735ae017e9a349b927cfc88f31c1"}, + {file = "coverage-7.6.7-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:acbb8af78f8f91b3b51f58f288c0994ba63c646bc1a8a22ad072e4e7e0a49f1c"}, + {file = "coverage-7.6.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ad32a981bcdedb8d2ace03b05e4fd8dace8901eec64a532b00b15217d3677dd2"}, + {file = "coverage-7.6.7-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:34d23e28ccb26236718a3a78ba72744212aa383141961dd6825f6595005c8b06"}, + {file = "coverage-7.6.7-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e25bacb53a8c7325e34d45dddd2f2fbae0dbc230d0e2642e264a64e17322a777"}, + {file = "coverage-7.6.7-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:af05bbba896c4472a29408455fe31b3797b4d8648ed0a2ccac03e074a77e2314"}, + {file = "coverage-7.6.7-cp310-cp310-win32.whl", hash = "sha256:796c9b107d11d2d69e1849b2dfe41730134b526a49d3acb98ca02f4985eeff7a"}, + {file = "coverage-7.6.7-cp310-cp310-win_amd64.whl", hash = "sha256:987a8e3da7da4eed10a20491cf790589a8e5e07656b6dc22d3814c4d88faf163"}, + {file = "coverage-7.6.7-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7e61b0e77ff4dddebb35a0e8bb5a68bf0f8b872407d8d9f0c726b65dfabe2469"}, + {file = "coverage-7.6.7-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1a5407a75ca4abc20d6252efeb238377a71ce7bda849c26c7a9bece8680a5d99"}, + {file = "coverage-7.6.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df002e59f2d29e889c37abd0b9ee0d0e6e38c24f5f55d71ff0e09e3412a340ec"}, + {file = "coverage-7.6.7-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:673184b3156cba06154825f25af33baa2671ddae6343f23175764e65a8c4c30b"}, + {file = "coverage-7.6.7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e69ad502f1a2243f739f5bd60565d14a278be58be4c137d90799f2c263e7049a"}, + {file = "coverage-7.6.7-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:60dcf7605c50ea72a14490d0756daffef77a5be15ed1b9fea468b1c7bda1bc3b"}, + {file = "coverage-7.6.7-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:9c2eb378bebb2c8f65befcb5147877fc1c9fbc640fc0aad3add759b5df79d55d"}, + {file = "coverage-7.6.7-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3c0317288f032221d35fa4cbc35d9f4923ff0dfd176c79c9b356e8ef8ef2dff4"}, + {file = "coverage-7.6.7-cp311-cp311-win32.whl", hash = "sha256:951aade8297358f3618a6e0660dc74f6b52233c42089d28525749fc8267dccd2"}, + {file = "coverage-7.6.7-cp311-cp311-win_amd64.whl", hash = "sha256:5e444b8e88339a2a67ce07d41faabb1d60d1004820cee5a2c2b54e2d8e429a0f"}, + {file = "coverage-7.6.7-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f07ff574986bc3edb80e2c36391678a271d555f91fd1d332a1e0f4b5ea4b6ea9"}, + {file = "coverage-7.6.7-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:49ed5ee4109258973630c1f9d099c7e72c5c36605029f3a91fe9982c6076c82b"}, + {file = "coverage-7.6.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f3e8796434a8106b3ac025fd15417315d7a58ee3e600ad4dbcfddc3f4b14342c"}, + {file = "coverage-7.6.7-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a3b925300484a3294d1c70f6b2b810d6526f2929de954e5b6be2bf8caa1f12c1"}, + {file = "coverage-7.6.7-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c42ec2c522e3ddd683dec5cdce8e62817afb648caedad9da725001fa530d354"}, + {file = "coverage-7.6.7-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0266b62cbea568bd5e93a4da364d05de422110cbed5056d69339bd5af5685433"}, + {file = "coverage-7.6.7-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:e5f2a0f161d126ccc7038f1f3029184dbdf8f018230af17ef6fd6a707a5b881f"}, + {file = "coverage-7.6.7-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c132b5a22821f9b143f87446805e13580b67c670a548b96da945a8f6b4f2efbb"}, + {file = "coverage-7.6.7-cp312-cp312-win32.whl", hash = "sha256:7c07de0d2a110f02af30883cd7dddbe704887617d5c27cf373362667445a4c76"}, + {file = "coverage-7.6.7-cp312-cp312-win_amd64.whl", hash = "sha256:fd49c01e5057a451c30c9b892948976f5d38f2cbd04dc556a82743ba8e27ed8c"}, + {file = "coverage-7.6.7-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:46f21663e358beae6b368429ffadf14ed0a329996248a847a4322fb2e35d64d3"}, + {file = "coverage-7.6.7-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:40cca284c7c310d622a1677f105e8507441d1bb7c226f41978ba7c86979609ab"}, + {file = "coverage-7.6.7-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77256ad2345c29fe59ae861aa11cfc74579c88d4e8dbf121cbe46b8e32aec808"}, + {file = "coverage-7.6.7-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:87ea64b9fa52bf395272e54020537990a28078478167ade6c61da7ac04dc14bc"}, + {file = "coverage-7.6.7-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2d608a7808793e3615e54e9267519351c3ae204a6d85764d8337bd95993581a8"}, + {file = "coverage-7.6.7-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdd94501d65adc5c24f8a1a0eda110452ba62b3f4aeaba01e021c1ed9cb8f34a"}, + {file = "coverage-7.6.7-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:82c809a62e953867cf57e0548c2b8464207f5f3a6ff0e1e961683e79b89f2c55"}, + {file = "coverage-7.6.7-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:bb684694e99d0b791a43e9fc0fa58efc15ec357ac48d25b619f207c41f2fd384"}, + {file = "coverage-7.6.7-cp313-cp313-win32.whl", hash = "sha256:963e4a08cbb0af6623e61492c0ec4c0ec5c5cf74db5f6564f98248d27ee57d30"}, + {file = "coverage-7.6.7-cp313-cp313-win_amd64.whl", hash = "sha256:14045b8bfd5909196a90da145a37f9d335a5d988a83db34e80f41e965fb7cb42"}, + {file = "coverage-7.6.7-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:f2c7a045eef561e9544359a0bf5784b44e55cefc7261a20e730baa9220c83413"}, + {file = "coverage-7.6.7-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:5dd4e4a49d9c72a38d18d641135d2fb0bdf7b726ca60a103836b3d00a1182acd"}, + {file = "coverage-7.6.7-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c95e0fa3d1547cb6f021ab72f5c23402da2358beec0a8e6d19a368bd7b0fb37"}, + {file = "coverage-7.6.7-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f63e21ed474edd23f7501f89b53280014436e383a14b9bd77a648366c81dce7b"}, + {file = "coverage-7.6.7-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ead9b9605c54d15be228687552916c89c9683c215370c4a44f1f217d2adcc34d"}, + {file = "coverage-7.6.7-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:0573f5cbf39114270842d01872952d301027d2d6e2d84013f30966313cadb529"}, + {file = "coverage-7.6.7-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:e2c8e3384c12dfa19fa9a52f23eb091a8fad93b5b81a41b14c17c78e23dd1d8b"}, + {file = "coverage-7.6.7-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:70a56a2ec1869e6e9fa69ef6b76b1a8a7ef709972b9cc473f9ce9d26b5997ce3"}, + {file = "coverage-7.6.7-cp313-cp313t-win32.whl", hash = "sha256:dbba8210f5067398b2c4d96b4e64d8fb943644d5eb70be0d989067c8ca40c0f8"}, + {file = "coverage-7.6.7-cp313-cp313t-win_amd64.whl", hash = "sha256:dfd14bcae0c94004baba5184d1c935ae0d1231b8409eb6c103a5fd75e8ecdc56"}, + {file = "coverage-7.6.7-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:37a15573f988b67f7348916077c6d8ad43adb75e478d0910957394df397d2874"}, + {file = "coverage-7.6.7-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b6cce5c76985f81da3769c52203ee94722cd5d5889731cd70d31fee939b74bf0"}, + {file = "coverage-7.6.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1ab9763d291a17b527ac6fd11d1a9a9c358280adb320e9c2672a97af346ac2c"}, + {file = "coverage-7.6.7-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6cf96ceaa275f071f1bea3067f8fd43bec184a25a962c754024c973af871e1b7"}, + {file = "coverage-7.6.7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aee9cf6b0134d6f932d219ce253ef0e624f4fa588ee64830fcba193269e4daa3"}, + {file = "coverage-7.6.7-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2bc3e45c16564cc72de09e37413262b9f99167803e5e48c6156bccdfb22c8327"}, + {file = "coverage-7.6.7-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:623e6965dcf4e28a3debaa6fcf4b99ee06d27218f46d43befe4db1c70841551c"}, + {file = "coverage-7.6.7-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:850cfd2d6fc26f8346f422920ac204e1d28814e32e3a58c19c91980fa74d8289"}, + {file = "coverage-7.6.7-cp39-cp39-win32.whl", hash = "sha256:c296263093f099da4f51b3dff1eff5d4959b527d4f2f419e16508c5da9e15e8c"}, + {file = "coverage-7.6.7-cp39-cp39-win_amd64.whl", hash = "sha256:90746521206c88bdb305a4bf3342b1b7316ab80f804d40c536fc7d329301ee13"}, + {file = "coverage-7.6.7-pp39.pp310-none-any.whl", hash = "sha256:0ddcb70b3a3a57581b450571b31cb774f23eb9519c2aaa6176d3a84c9fc57671"}, + {file = "coverage-7.6.7.tar.gz", hash = "sha256:d79d4826e41441c9a118ff045e4bccb9fdbdcb1d02413e7ea6eb5c87b5439d24"}, ] [package.dependencies] @@ -315,13 +315,13 @@ files = [ [[package]] name = "httpcore" -version = "1.0.6" +version = "1.0.7" description = "A minimal low-level HTTP client." optional = false python-versions = ">=3.8" files = [ - {file = "httpcore-1.0.6-py3-none-any.whl", hash = "sha256:27b59625743b85577a8c0e10e55b50b5368a4f2cfe8cc7bcfa9cf00829c2682f"}, - {file = "httpcore-1.0.6.tar.gz", hash = "sha256:73f6dbd6eb8c21bbf7ef8efad555481853f5f6acdeaff1edb0694289269ee17f"}, + {file = "httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd"}, + {file = "httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c"}, ] [package.dependencies] @@ -537,13 +537,13 @@ url = "../../standard-tests" [[package]] name = "langsmith" -version = "0.1.142" +version = "0.1.143" description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform." optional = false python-versions = "<4.0,>=3.8.1" files = [ - {file = "langsmith-0.1.142-py3-none-any.whl", hash = "sha256:f639ca23c9a0bb77af5fb881679b2f66ff1f21f19d0bebf4e51375e7585a8b38"}, - {file = "langsmith-0.1.142.tar.gz", hash = "sha256:f8a84d100f3052233ff0a1d66ae14c5dfc20b7e41a1601de011384f16ee6cb82"}, + {file = "langsmith-0.1.143-py3-none-any.whl", hash = "sha256:ba0d827269e9b03a90fababe41fa3e4e3f833300b95add10184f7e67167dde6f"}, + {file = "langsmith-0.1.143.tar.gz", hash = "sha256:4c5159e5cd84b3f8499433009e72d2076dd2daf6c044ac8a3611b30d0d0161c5"}, ] [package.dependencies] @@ -667,13 +667,13 @@ files = [ [[package]] name = "openai" -version = "1.54.3" +version = "1.54.4" description = "The official Python library for the openai API" optional = false python-versions = ">=3.8" files = [ - {file = "openai-1.54.3-py3-none-any.whl", hash = "sha256:f18dbaf09c50d70c4185b892a2a553f80681d1d866323a2da7f7be2f688615d5"}, - {file = "openai-1.54.3.tar.gz", hash = "sha256:7511b74eeb894ac0b0253dc71f087a15d2e4d71d22d0088767205143d880cca6"}, + {file = "openai-1.54.4-py3-none-any.whl", hash = "sha256:0d95cef99346bf9b6d7fbf57faf61a673924c3e34fa8af84c9ffe04660673a7e"}, + {file = "openai-1.54.4.tar.gz", hash = "sha256:50f3656e45401c54e973fa05dc29f3f0b0d19348d685b2f7ddb4d92bf7b1b6bf"}, ] [package.dependencies] diff --git a/libs/partners/openai/pyproject.toml b/libs/partners/openai/pyproject.toml index 492cbc63eac4b..744812533a7eb 100644 --- a/libs/partners/openai/pyproject.toml +++ b/libs/partners/openai/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "langchain-openai" -version = "0.2.8" +version = "0.2.9" description = "An integration package connecting OpenAI and LangChain" authors = [] readme = "README.md" From 24eea2e3981ba1addf5ffd01d1a9ad450cc8fadc Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 18 Nov 2024 17:43:08 -0800 Subject: [PATCH 11/17] infra: allow non-langchainai packages (#28199) --- .github/scripts/prep_api_docs_build.py | 36 ++++++++++++++------------ .github/workflows/api_doc_build.yml | 4 +-- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/scripts/prep_api_docs_build.py b/.github/scripts/prep_api_docs_build.py index 2c2655e2155a4..0ddd7ac053de5 100644 --- a/.github/scripts/prep_api_docs_build.py +++ b/.github/scripts/prep_api_docs_build.py @@ -11,7 +11,9 @@ def load_packages_yaml() -> Dict[str, Any]: """Load and parse the packages.yml file.""" with open("langchain/libs/packages.yml", "r") as f: - return yaml.safe_load(f) + all_packages = yaml.safe_load(f) + + return {k: v for k, v in all_packages.items() if k["repo"]} def get_target_dir(package_name: str) -> Path: @@ -23,24 +25,19 @@ def get_target_dir(package_name: str) -> Path: return base_path / "partners" / package_name_short -def clean_target_directories(packages: Dict[str, Any]) -> None: +def clean_target_directories(packages: list) -> None: """Remove old directories that will be replaced.""" - for package in packages["packages"]: - if package["repo"] != "langchain-ai/langchain": - target_dir = get_target_dir(package["name"]) - if target_dir.exists(): - print(f"Removing {target_dir}") - shutil.rmtree(target_dir) + for package in packages: + + target_dir = get_target_dir(package["name"]) + if target_dir.exists(): + print(f"Removing {target_dir}") + shutil.rmtree(target_dir) -def move_libraries(packages: Dict[str, Any]) -> None: +def move_libraries(packages: list) -> None: """Move libraries from their source locations to the target directories.""" - for package in packages["packages"]: - # Skip if it's the main langchain repo or disabled - if package["repo"] == "langchain-ai/langchain" or package.get( - "disabled", False - ): - continue + for package in packages: repo_name = package["repo"].split("/")[1] source_path = package["path"] @@ -68,7 +65,14 @@ def main(): """Main function to orchestrate the library sync process.""" try: # Load packages configuration - packages = load_packages_yaml() + package_yaml = load_packages_yaml() + packages = [ + p + for p in package_yaml["packages"] + if not p.get("disabled", False) + and p["repo"].startswith("langchain-ai/") + and p["repo"] != "langchain-ai/langchain" + ] # Clean target directories clean_target_directories(packages) diff --git a/.github/workflows/api_doc_build.yml b/.github/workflows/api_doc_build.yml index 26e2b19cb4602..959f35a94bd37 100644 --- a/.github/workflows/api_doc_build.yml +++ b/.github/workflows/api_doc_build.yml @@ -37,9 +37,9 @@ jobs: # Get unique repositories REPOS=$(echo "$REPOS_UNSORTED" | sort -u) - # Checkout each unique repository + # Checkout each unique repository that is in langchain-ai org for repo in $REPOS; do - if [ "$repo" != "langchain-ai/langchain" ]; then + if [[ "$repo" != "langchain-ai/langchain" && "$repo" == langchain-ai/* ]]; then REPO_NAME=$(echo $repo | cut -d'/' -f2) echo "Checking out $repo to $REPO_NAME" git clone --depth 1 https://github.com/$repo.git $REPO_NAME From 0dbaf05bb7f15a1040849747e0b5ecaf2292087a Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 18 Nov 2024 19:10:39 -0800 Subject: [PATCH 12/17] standard-tests: rename langchain_standard_tests to langchain_tests, release 0.3.2 (#28203) --- .github/workflows/_release.yml | 6 +----- .../how_to/integrations/standard_tests.ipynb | 20 +++++++------------ .../chat_models/test_litellm_standard.py | 2 +- .../chat_models/test_moonshot.py | 2 +- .../integration_tests/storage/test_mongodb.py | 2 +- .../vectorstores/test_aperturedb.py | 2 +- .../chat_models/test_cloudflare_workersai.py | 2 +- .../unit_tests/chat_models/test_litellm.py | 2 +- .../unit_tests/vectorstores/test_inmemory.py | 2 +- .../indexing/test_in_memory_indexer.py | 2 +- .../tests/unit_tests/stores/test_in_memory.py | 2 +- .../unit_tests/vectorstores/test_in_memory.py | 2 +- .../chat_models/test_base.py | 2 +- .../tests/integration_tests/test_standard.py | 2 +- .../tests/unit_tests/test_standard.py | 2 +- .../tests/integration_tests/test_standard.py | 2 +- .../unit_tests/test_embeddings_standard.py | 2 +- .../tests/unit_tests/test_standard.py | 2 +- .../integration_tests/test_chat_models.py | 2 +- .../tests/integration_tests/test_standard.py | 2 +- .../groq/tests/unit_tests/test_standard.py | 2 +- .../test_embeddings_standard.py | 2 +- .../tests/integration_tests/test_standard.py | 2 +- .../tests/integration_tests/test_standard.py | 2 +- .../tests/unit_tests/test_standard.py | 2 +- .../integration_tests/test_chat_models.py | 2 +- .../integration_tests/test_embeddings.py | 2 +- .../tests/unit_tests/test_chat_models.py | 2 +- .../chat_models/test_azure_standard.py | 2 +- .../chat_models/test_base.py | 12 +++++------ .../chat_models/test_base_standard.py | 2 +- .../chat_models/test_azure_standard.py | 2 +- .../chat_models/test_base_standard.py | 2 +- .../embeddings/test_azure_standard.py | 2 +- .../embeddings/test_base_standard.py | 2 +- .../test_chat_models_standard.py | 2 +- .../unit_tests/test_chat_models_standard.py | 2 +- libs/standard-tests/Makefile | 4 ++-- libs/standard-tests/README.md | 4 ++-- .../__init__.py | 0 .../base.py | 2 +- .../integration_tests/__init__.py | 4 +--- .../integration_tests/base_store.py | 2 +- .../integration_tests/cache.py | 2 +- .../integration_tests/chat_models.py | 4 ++-- .../integration_tests/embeddings.py | 2 +- .../integration_tests/indexer.py | 0 .../integration_tests/tools.py | 2 +- .../integration_tests/vectorstores.py | 2 +- .../py.typed | 0 .../unit_tests/__init__.py | 2 +- .../unit_tests/chat_models.py | 4 ++-- .../unit_tests/embeddings.py | 2 +- .../unit_tests/tools.py | 2 +- .../utils/__init__.py | 0 .../utils/pydantic.py | 0 libs/standard-tests/pyproject.toml | 3 +-- .../unit_tests/test_in_memory_base_store.py | 2 +- .../tests/unit_tests/test_in_memory_cache.py | 2 +- .../unit_tests/test_in_memory_vectorstore.py | 2 +- 60 files changed, 70 insertions(+), 83 deletions(-) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/__init__.py (100%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/base.py (96%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/integration_tests/__init__.py (90%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/integration_tests/base_store.py (99%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/integration_tests/cache.py (99%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/integration_tests/chat_models.py (99%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/integration_tests/embeddings.py (96%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/integration_tests/indexer.py (100%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/integration_tests/tools.py (97%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/integration_tests/vectorstores.py (99%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/py.typed (100%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/unit_tests/__init__.py (86%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/unit_tests/chat_models.py (98%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/unit_tests/embeddings.py (96%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/unit_tests/tools.py (97%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/utils/__init__.py (100%) rename libs/standard-tests/{langchain_standard_tests => langchain_tests}/utils/pydantic.py (100%) diff --git a/.github/workflows/_release.yml b/.github/workflows/_release.yml index 6dcbfcda11043..bf0c1e0454f20 100644 --- a/.github/workflows/_release.yml +++ b/.github/workflows/_release.yml @@ -219,11 +219,7 @@ jobs: # Replace all dashes in the package name with underscores, # since that's how Python imports packages with dashes in the name. - if [ "$PKG_NAME" == "langchain-tests" ]; then - IMPORT_NAME="langchain_standard_tests" - else - IMPORT_NAME="$(echo "$PKG_NAME" | sed s/-/_/g)" - fi + IMPORT_NAME="$(echo "$PKG_NAME" | sed s/-/_/g)" poetry run python -c "import $IMPORT_NAME; print(dir($IMPORT_NAME))" diff --git a/docs/docs/contributing/how_to/integrations/standard_tests.ipynb b/docs/docs/contributing/how_to/integrations/standard_tests.ipynb index c741a76077304..ace79d531305f 100644 --- a/docs/docs/contributing/how_to/integrations/standard_tests.ipynb +++ b/docs/docs/contributing/how_to/integrations/standard_tests.ipynb @@ -15,16 +15,10 @@ "First, let's install 2 dependencies:\n", "\n", "- `langchain-core` will define the interfaces we want to import to define our custom tool.\n", - "- `langchain-tests==0.3.0` will provide the standard tests we want to use.\n", + "- `langchain-tests==0.3.2` will provide the standard tests we want to use.\n", "\n", ":::note\n", "\n", - "The `langchain-tests` package contains the module `langchain_standard_tests`. This name\n", - "mistmatch is due to this package historically being called `langchain_standard_tests` and\n", - "the name not being available on PyPi. This will either be reconciled by our \n", - "[PEP 541 request](https://github.com/pypi/support/issues/5062) (we welcome upvotes!), \n", - "or in a new release of `langchain-tests`.\n", - "\n", "Because added tests in new versions of `langchain-tests` will always break your CI/CD pipelines, we recommend pinning the \n", "version of `langchain-tests==0.3.0` to avoid unexpected changes.\n", "\n", @@ -91,8 +85,8 @@ "\n", "There are 2 namespaces in the `langchain-tests` package: \n", "\n", - "- unit tests (`langchain_standard_tests.unit_tests`): designed to be used to test the tool in isolation and without access to external services\n", - "- integration tests (`langchain_standard_tests.integration_tests`): designed to be used to test the tool with access to external services (in particular, the external service that the tool is designed to interact with).\n", + "- unit tests (`langchain_tests.unit_tests`): designed to be used to test the tool in isolation and without access to external services\n", + "- integration tests (`langchain_tests.integration_tests`): designed to be used to test the tool with access to external services (in particular, the external service that the tool is designed to interact with).\n", "\n", ":::note\n", "\n", @@ -122,7 +116,7 @@ "from typing import Type\n", "\n", "from langchain_parrot_link.tools import ParrotMultiplyTool\n", - "from langchain_standard_tests.unit_tests import ToolsUnitTests\n", + "from langchain_tests.unit_tests import ToolsUnitTests\n", "\n", "\n", "class TestParrotMultiplyToolUnit(ToolsUnitTests):\n", @@ -156,7 +150,7 @@ "from typing import Type\n", "\n", "from langchain_parrot_link.tools import ParrotMultiplyTool\n", - "from langchain_standard_tests.integration_tests import ToolsIntegrationTests\n", + "from langchain_tests.integration_tests import ToolsIntegrationTests\n", "\n", "\n", "class TestParrotMultiplyToolIntegration(ToolsIntegrationTests):\n", @@ -217,7 +211,7 @@ "from typing import Tuple, Type\n", "\n", "from langchain_parrot_link.chat_models import ChatParrotLink\n", - "from langchain_standard_tests.unit_tests import ChatModelUnitTests\n", + "from langchain_tests.unit_tests import ChatModelUnitTests\n", "\n", "\n", "class TestChatParrotLinkUnit(ChatModelUnitTests):\n", @@ -236,7 +230,7 @@ "from typing import Type\n", "\n", "from langchain_parrot_link.chat_models import ChatParrotLink\n", - "from langchain_standard_tests.integration_tests import ChatModelIntegrationTests\n", + "from langchain_tests.integration_tests import ChatModelIntegrationTests\n", "\n", "\n", "class TestChatParrotLinkIntegration(ChatModelIntegrationTests):\n", diff --git a/libs/community/tests/integration_tests/chat_models/test_litellm_standard.py b/libs/community/tests/integration_tests/chat_models/test_litellm_standard.py index 972617617bd4c..5e87e3ac8a0e2 100644 --- a/libs/community/tests/integration_tests/chat_models/test_litellm_standard.py +++ b/libs/community/tests/integration_tests/chat_models/test_litellm_standard.py @@ -4,7 +4,7 @@ import pytest from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.integration_tests import ChatModelIntegrationTests +from langchain_tests.integration_tests import ChatModelIntegrationTests from langchain_community.chat_models.litellm import ChatLiteLLM diff --git a/libs/community/tests/integration_tests/chat_models/test_moonshot.py b/libs/community/tests/integration_tests/chat_models/test_moonshot.py index 68d9f43b5d8f0..de4725cfa6c8e 100644 --- a/libs/community/tests/integration_tests/chat_models/test_moonshot.py +++ b/libs/community/tests/integration_tests/chat_models/test_moonshot.py @@ -4,7 +4,7 @@ import pytest from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.integration_tests import ChatModelIntegrationTests +from langchain_tests.integration_tests import ChatModelIntegrationTests from pydantic import SecretStr from langchain_community.chat_models.moonshot import MoonshotChat diff --git a/libs/community/tests/integration_tests/storage/test_mongodb.py b/libs/community/tests/integration_tests/storage/test_mongodb.py index 850e4f73c2b47..82aa4b76057f3 100644 --- a/libs/community/tests/integration_tests/storage/test_mongodb.py +++ b/libs/community/tests/integration_tests/storage/test_mongodb.py @@ -2,7 +2,7 @@ import pytest from langchain_core.documents import Document -from langchain_standard_tests.integration_tests.base_store import BaseStoreSyncTests +from langchain_tests.integration_tests.base_store import BaseStoreSyncTests from langchain_community.storage.mongodb import MongoDBByteStore, MongoDBStore diff --git a/libs/community/tests/integration_tests/vectorstores/test_aperturedb.py b/libs/community/tests/integration_tests/vectorstores/test_aperturedb.py index 9e5f370d7d4cb..15d65de90b136 100644 --- a/libs/community/tests/integration_tests/vectorstores/test_aperturedb.py +++ b/libs/community/tests/integration_tests/vectorstores/test_aperturedb.py @@ -3,7 +3,7 @@ import uuid import pytest -from langchain_standard_tests.integration_tests.vectorstores import ( +from langchain_tests.integration_tests.vectorstores import ( AsyncReadWriteTestSuite, ReadWriteTestSuite, ) diff --git a/libs/community/tests/unit_tests/chat_models/test_cloudflare_workersai.py b/libs/community/tests/unit_tests/chat_models/test_cloudflare_workersai.py index 940616048de02..0f0fabe3cd1e5 100644 --- a/libs/community/tests/unit_tests/chat_models/test_cloudflare_workersai.py +++ b/libs/community/tests/unit_tests/chat_models/test_cloudflare_workersai.py @@ -11,7 +11,7 @@ SystemMessage, ToolMessage, ) -from langchain_standard_tests.unit_tests import ChatModelUnitTests +from langchain_tests.unit_tests import ChatModelUnitTests from langchain_community.chat_models.cloudflare_workersai import ( ChatCloudflareWorkersAI, diff --git a/libs/community/tests/unit_tests/chat_models/test_litellm.py b/libs/community/tests/unit_tests/chat_models/test_litellm.py index 583c53d64bd1d..1d11fe5bd3f0a 100644 --- a/libs/community/tests/unit_tests/chat_models/test_litellm.py +++ b/libs/community/tests/unit_tests/chat_models/test_litellm.py @@ -4,7 +4,7 @@ import pytest from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.unit_tests import ChatModelUnitTests +from langchain_tests.unit_tests import ChatModelUnitTests from langchain_community.chat_models.litellm import ChatLiteLLM diff --git a/libs/community/tests/unit_tests/vectorstores/test_inmemory.py b/libs/community/tests/unit_tests/vectorstores/test_inmemory.py index 6facca3429b2a..b650cda14fdd1 100644 --- a/libs/community/tests/unit_tests/vectorstores/test_inmemory.py +++ b/libs/community/tests/unit_tests/vectorstores/test_inmemory.py @@ -3,7 +3,7 @@ import pytest from langchain_core.documents import Document -from langchain_standard_tests.integration_tests.vectorstores import ( +from langchain_tests.integration_tests.vectorstores import ( AsyncReadWriteTestSuite, ReadWriteTestSuite, ) diff --git a/libs/core/tests/unit_tests/indexing/test_in_memory_indexer.py b/libs/core/tests/unit_tests/indexing/test_in_memory_indexer.py index 6ddeefc62330b..58ee2514644dd 100644 --- a/libs/core/tests/unit_tests/indexing/test_in_memory_indexer.py +++ b/libs/core/tests/unit_tests/indexing/test_in_memory_indexer.py @@ -3,7 +3,7 @@ from collections.abc import AsyncGenerator, Generator import pytest -from langchain_standard_tests.integration_tests.indexer import ( +from langchain_tests.integration_tests.indexer import ( AsyncDocumentIndexTestSuite, DocumentIndexerTestSuite, ) diff --git a/libs/core/tests/unit_tests/stores/test_in_memory.py b/libs/core/tests/unit_tests/stores/test_in_memory.py index 3c5f810b1fc6a..1ae91db4a385e 100644 --- a/libs/core/tests/unit_tests/stores/test_in_memory.py +++ b/libs/core/tests/unit_tests/stores/test_in_memory.py @@ -1,5 +1,5 @@ import pytest -from langchain_standard_tests.integration_tests.base_store import ( +from langchain_tests.integration_tests.base_store import ( BaseStoreAsyncTests, BaseStoreSyncTests, ) diff --git a/libs/core/tests/unit_tests/vectorstores/test_in_memory.py b/libs/core/tests/unit_tests/vectorstores/test_in_memory.py index 1ab6186882639..34764f99c1016 100644 --- a/libs/core/tests/unit_tests/vectorstores/test_in_memory.py +++ b/libs/core/tests/unit_tests/vectorstores/test_in_memory.py @@ -2,7 +2,7 @@ from unittest.mock import AsyncMock, Mock import pytest -from langchain_standard_tests.integration_tests.vectorstores import ( +from langchain_tests.integration_tests.vectorstores import ( AsyncReadWriteTestSuite, ReadWriteTestSuite, ) diff --git a/libs/langchain/tests/integration_tests/chat_models/test_base.py b/libs/langchain/tests/integration_tests/chat_models/test_base.py index efed6e1d52290..baee018999c28 100644 --- a/libs/langchain/tests/integration_tests/chat_models/test_base.py +++ b/libs/langchain/tests/integration_tests/chat_models/test_base.py @@ -5,7 +5,7 @@ from langchain_core.messages import AIMessage from langchain_core.prompts import ChatPromptTemplate from langchain_core.runnables import RunnableConfig -from langchain_standard_tests.integration_tests import ChatModelIntegrationTests +from langchain_tests.integration_tests import ChatModelIntegrationTests from pydantic import BaseModel from langchain.chat_models import init_chat_model diff --git a/libs/partners/anthropic/tests/integration_tests/test_standard.py b/libs/partners/anthropic/tests/integration_tests/test_standard.py index 241588f32a34c..dc69c1dda4034 100644 --- a/libs/partners/anthropic/tests/integration_tests/test_standard.py +++ b/libs/partners/anthropic/tests/integration_tests/test_standard.py @@ -5,7 +5,7 @@ from langchain_core.language_models import BaseChatModel from langchain_core.messages import AIMessage -from langchain_standard_tests.integration_tests import ChatModelIntegrationTests +from langchain_tests.integration_tests import ChatModelIntegrationTests from langchain_anthropic import ChatAnthropic diff --git a/libs/partners/anthropic/tests/unit_tests/test_standard.py b/libs/partners/anthropic/tests/unit_tests/test_standard.py index 7976dcb2bc9cf..7879e2995bb8e 100644 --- a/libs/partners/anthropic/tests/unit_tests/test_standard.py +++ b/libs/partners/anthropic/tests/unit_tests/test_standard.py @@ -3,7 +3,7 @@ from typing import Type from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.unit_tests import ChatModelUnitTests +from langchain_tests.unit_tests import ChatModelUnitTests from langchain_anthropic import ChatAnthropic diff --git a/libs/partners/fireworks/tests/integration_tests/test_standard.py b/libs/partners/fireworks/tests/integration_tests/test_standard.py index cfefb2445e6a3..692dcb40cf357 100644 --- a/libs/partners/fireworks/tests/integration_tests/test_standard.py +++ b/libs/partners/fireworks/tests/integration_tests/test_standard.py @@ -4,7 +4,7 @@ import pytest from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.integration_tests import ( # type: ignore[import-not-found] +from langchain_tests.integration_tests import ( # type: ignore[import-not-found] ChatModelIntegrationTests, # type: ignore[import-not-found] ) diff --git a/libs/partners/fireworks/tests/unit_tests/test_embeddings_standard.py b/libs/partners/fireworks/tests/unit_tests/test_embeddings_standard.py index ea8d16f92d0a8..44b6197a39181 100644 --- a/libs/partners/fireworks/tests/unit_tests/test_embeddings_standard.py +++ b/libs/partners/fireworks/tests/unit_tests/test_embeddings_standard.py @@ -3,7 +3,7 @@ from typing import Tuple, Type from langchain_core.embeddings import Embeddings -from langchain_standard_tests.unit_tests.embeddings import EmbeddingsUnitTests +from langchain_tests.unit_tests.embeddings import EmbeddingsUnitTests from langchain_fireworks import FireworksEmbeddings diff --git a/libs/partners/fireworks/tests/unit_tests/test_standard.py b/libs/partners/fireworks/tests/unit_tests/test_standard.py index 61d0d152ba831..4f444897154a8 100644 --- a/libs/partners/fireworks/tests/unit_tests/test_standard.py +++ b/libs/partners/fireworks/tests/unit_tests/test_standard.py @@ -3,7 +3,7 @@ from typing import Tuple, Type from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.unit_tests import ( # type: ignore[import-not-found] +from langchain_tests.unit_tests import ( # type: ignore[import-not-found] ChatModelUnitTests, # type: ignore[import-not-found] ) diff --git a/libs/partners/groq/tests/integration_tests/test_chat_models.py b/libs/partners/groq/tests/integration_tests/test_chat_models.py index 1b2cf05b54239..a672de34bc53e 100644 --- a/libs/partners/groq/tests/integration_tests/test_chat_models.py +++ b/libs/partners/groq/tests/integration_tests/test_chat_models.py @@ -395,7 +395,7 @@ class Joke(BaseModel): def test_tool_calling_no_arguments() -> None: - # Note: this is a variant of a test in langchain_standard_tests + # Note: this is a variant of a test in langchain_tests # that as of 2024-08-19 fails with "Failed to call a function. Please # adjust your prompt." when `tool_choice="any"` is specified, but # passes when `tool_choice` is not specified. diff --git a/libs/partners/groq/tests/integration_tests/test_standard.py b/libs/partners/groq/tests/integration_tests/test_standard.py index d34257b4c529e..3870ae953f6ee 100644 --- a/libs/partners/groq/tests/integration_tests/test_standard.py +++ b/libs/partners/groq/tests/integration_tests/test_standard.py @@ -5,7 +5,7 @@ import pytest from langchain_core.language_models import BaseChatModel from langchain_core.rate_limiters import InMemoryRateLimiter -from langchain_standard_tests.integration_tests import ( +from langchain_tests.integration_tests import ( ChatModelIntegrationTests, ) diff --git a/libs/partners/groq/tests/unit_tests/test_standard.py b/libs/partners/groq/tests/unit_tests/test_standard.py index 939d817499e25..e4df2916f3052 100644 --- a/libs/partners/groq/tests/unit_tests/test_standard.py +++ b/libs/partners/groq/tests/unit_tests/test_standard.py @@ -3,7 +3,7 @@ from typing import Type from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.unit_tests.chat_models import ( +from langchain_tests.unit_tests.chat_models import ( ChatModelUnitTests, ) diff --git a/libs/partners/huggingface/tests/integration_tests/test_embeddings_standard.py b/libs/partners/huggingface/tests/integration_tests/test_embeddings_standard.py index 4f5cefcbdff2c..a878bea8cfa8a 100644 --- a/libs/partners/huggingface/tests/integration_tests/test_embeddings_standard.py +++ b/libs/partners/huggingface/tests/integration_tests/test_embeddings_standard.py @@ -2,7 +2,7 @@ from typing import Type -from langchain_standard_tests.integration_tests import EmbeddingsIntegrationTests +from langchain_tests.integration_tests import EmbeddingsIntegrationTests from langchain_huggingface.embeddings import ( HuggingFaceEmbeddings, diff --git a/libs/partners/huggingface/tests/integration_tests/test_standard.py b/libs/partners/huggingface/tests/integration_tests/test_standard.py index 34392e979f437..682a4c625ee9f 100644 --- a/libs/partners/huggingface/tests/integration_tests/test_standard.py +++ b/libs/partners/huggingface/tests/integration_tests/test_standard.py @@ -4,7 +4,7 @@ import pytest from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.integration_tests import ChatModelIntegrationTests +from langchain_tests.integration_tests import ChatModelIntegrationTests from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint diff --git a/libs/partners/mistralai/tests/integration_tests/test_standard.py b/libs/partners/mistralai/tests/integration_tests/test_standard.py index cea6399ee4cd8..822f2284abc1c 100644 --- a/libs/partners/mistralai/tests/integration_tests/test_standard.py +++ b/libs/partners/mistralai/tests/integration_tests/test_standard.py @@ -3,7 +3,7 @@ from typing import Optional, Type from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.integration_tests import ( # type: ignore[import-not-found] +from langchain_tests.integration_tests import ( # type: ignore[import-not-found] ChatModelIntegrationTests, # type: ignore[import-not-found] ) diff --git a/libs/partners/mistralai/tests/unit_tests/test_standard.py b/libs/partners/mistralai/tests/unit_tests/test_standard.py index 408a6e5a6b9f8..fde82de2d5071 100644 --- a/libs/partners/mistralai/tests/unit_tests/test_standard.py +++ b/libs/partners/mistralai/tests/unit_tests/test_standard.py @@ -3,7 +3,7 @@ from typing import Type from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.unit_tests import ( # type: ignore[import-not-found] +from langchain_tests.unit_tests import ( # type: ignore[import-not-found] ChatModelUnitTests, # type: ignore[import-not-found] ) diff --git a/libs/partners/ollama/tests/integration_tests/test_chat_models.py b/libs/partners/ollama/tests/integration_tests/test_chat_models.py index 10ffcb39d2777..9133106cae7b9 100644 --- a/libs/partners/ollama/tests/integration_tests/test_chat_models.py +++ b/libs/partners/ollama/tests/integration_tests/test_chat_models.py @@ -4,7 +4,7 @@ import pytest from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.integration_tests import ChatModelIntegrationTests +from langchain_tests.integration_tests import ChatModelIntegrationTests from langchain_ollama.chat_models import ChatOllama diff --git a/libs/partners/ollama/tests/integration_tests/test_embeddings.py b/libs/partners/ollama/tests/integration_tests/test_embeddings.py index 26722362e6b66..0953510c901aa 100644 --- a/libs/partners/ollama/tests/integration_tests/test_embeddings.py +++ b/libs/partners/ollama/tests/integration_tests/test_embeddings.py @@ -2,7 +2,7 @@ from typing import Type -from langchain_standard_tests.integration_tests import EmbeddingsIntegrationTests +from langchain_tests.integration_tests import EmbeddingsIntegrationTests from langchain_ollama.embeddings import OllamaEmbeddings diff --git a/libs/partners/ollama/tests/unit_tests/test_chat_models.py b/libs/partners/ollama/tests/unit_tests/test_chat_models.py index d086914310489..850e3423e0bf9 100644 --- a/libs/partners/ollama/tests/unit_tests/test_chat_models.py +++ b/libs/partners/ollama/tests/unit_tests/test_chat_models.py @@ -2,7 +2,7 @@ from typing import Dict, Type -from langchain_standard_tests.unit_tests import ChatModelUnitTests +from langchain_tests.unit_tests import ChatModelUnitTests from langchain_ollama.chat_models import ChatOllama diff --git a/libs/partners/openai/tests/integration_tests/chat_models/test_azure_standard.py b/libs/partners/openai/tests/integration_tests/chat_models/test_azure_standard.py index c99bfb1126e22..fff0599963c2f 100644 --- a/libs/partners/openai/tests/integration_tests/chat_models/test_azure_standard.py +++ b/libs/partners/openai/tests/integration_tests/chat_models/test_azure_standard.py @@ -5,7 +5,7 @@ import pytest from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.integration_tests import ChatModelIntegrationTests +from langchain_tests.integration_tests import ChatModelIntegrationTests from langchain_openai import AzureChatOpenAI diff --git a/libs/partners/openai/tests/integration_tests/chat_models/test_base.py b/libs/partners/openai/tests/integration_tests/chat_models/test_base.py index 858ab1e4b4321..cbee0d7041850 100644 --- a/libs/partners/openai/tests/integration_tests/chat_models/test_base.py +++ b/libs/partners/openai/tests/integration_tests/chat_models/test_base.py @@ -22,10 +22,8 @@ ) from langchain_core.outputs import ChatGeneration, ChatResult, LLMResult from langchain_core.prompts import ChatPromptTemplate -from langchain_standard_tests.integration_tests.chat_models import ( - _validate_tool_call_message, -) -from langchain_standard_tests.integration_tests.chat_models import ( +from langchain_tests.integration_tests.chat_models import _validate_tool_call_message +from langchain_tests.integration_tests.chat_models import ( magic_function as invalid_magic_function, ) from pydantic import BaseModel, Field @@ -1022,7 +1020,8 @@ def test_audio_input_modality() -> None: def test_prediction_tokens() -> None: - code = dedent(""" + code = dedent( + """ /// /// Represents a user with a first name, last name, and username. /// @@ -1043,7 +1042,8 @@ def test_prediction_tokens() -> None: /// public string Username { get; set; } } - """) + """ + ) llm = ChatOpenAI(model="gpt-4o") query = ( diff --git a/libs/partners/openai/tests/integration_tests/chat_models/test_base_standard.py b/libs/partners/openai/tests/integration_tests/chat_models/test_base_standard.py index b021603aace41..890e70268085f 100644 --- a/libs/partners/openai/tests/integration_tests/chat_models/test_base_standard.py +++ b/libs/partners/openai/tests/integration_tests/chat_models/test_base_standard.py @@ -5,7 +5,7 @@ from langchain_core.language_models import BaseChatModel from langchain_core.messages import AIMessage -from langchain_standard_tests.integration_tests import ChatModelIntegrationTests +from langchain_tests.integration_tests import ChatModelIntegrationTests from langchain_openai import ChatOpenAI diff --git a/libs/partners/openai/tests/unit_tests/chat_models/test_azure_standard.py b/libs/partners/openai/tests/unit_tests/chat_models/test_azure_standard.py index 465c1dc0c22a5..3d1faa97db485 100644 --- a/libs/partners/openai/tests/unit_tests/chat_models/test_azure_standard.py +++ b/libs/partners/openai/tests/unit_tests/chat_models/test_azure_standard.py @@ -4,7 +4,7 @@ import pytest from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.unit_tests import ChatModelUnitTests +from langchain_tests.unit_tests import ChatModelUnitTests from langchain_openai import AzureChatOpenAI diff --git a/libs/partners/openai/tests/unit_tests/chat_models/test_base_standard.py b/libs/partners/openai/tests/unit_tests/chat_models/test_base_standard.py index 8049da874cbf3..d24ddd1e71f7e 100644 --- a/libs/partners/openai/tests/unit_tests/chat_models/test_base_standard.py +++ b/libs/partners/openai/tests/unit_tests/chat_models/test_base_standard.py @@ -3,7 +3,7 @@ from typing import Tuple, Type from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.unit_tests import ChatModelUnitTests +from langchain_tests.unit_tests import ChatModelUnitTests from langchain_openai import ChatOpenAI diff --git a/libs/partners/openai/tests/unit_tests/embeddings/test_azure_standard.py b/libs/partners/openai/tests/unit_tests/embeddings/test_azure_standard.py index b5f1591c476ca..a972fe5e38581 100644 --- a/libs/partners/openai/tests/unit_tests/embeddings/test_azure_standard.py +++ b/libs/partners/openai/tests/unit_tests/embeddings/test_azure_standard.py @@ -1,7 +1,7 @@ from typing import Tuple, Type from langchain_core.embeddings import Embeddings -from langchain_standard_tests.unit_tests.embeddings import EmbeddingsUnitTests +from langchain_tests.unit_tests.embeddings import EmbeddingsUnitTests from langchain_openai import AzureOpenAIEmbeddings diff --git a/libs/partners/openai/tests/unit_tests/embeddings/test_base_standard.py b/libs/partners/openai/tests/unit_tests/embeddings/test_base_standard.py index b265e5600eb35..b1b2f2d368fa9 100644 --- a/libs/partners/openai/tests/unit_tests/embeddings/test_base_standard.py +++ b/libs/partners/openai/tests/unit_tests/embeddings/test_base_standard.py @@ -3,7 +3,7 @@ from typing import Tuple, Type from langchain_core.embeddings import Embeddings -from langchain_standard_tests.unit_tests.embeddings import EmbeddingsUnitTests +from langchain_tests.unit_tests.embeddings import EmbeddingsUnitTests from langchain_openai import OpenAIEmbeddings diff --git a/libs/partners/xai/tests/integration_tests/test_chat_models_standard.py b/libs/partners/xai/tests/integration_tests/test_chat_models_standard.py index c686f7e19486c..1152fe44946f7 100644 --- a/libs/partners/xai/tests/integration_tests/test_chat_models_standard.py +++ b/libs/partners/xai/tests/integration_tests/test_chat_models_standard.py @@ -5,7 +5,7 @@ import pytest # type: ignore[import-not-found] from langchain_core.language_models import BaseChatModel from langchain_core.rate_limiters import InMemoryRateLimiter -from langchain_standard_tests.integration_tests import ( # type: ignore[import-not-found] +from langchain_tests.integration_tests import ( # type: ignore[import-not-found] ChatModelIntegrationTests, # type: ignore[import-not-found] ) diff --git a/libs/partners/xai/tests/unit_tests/test_chat_models_standard.py b/libs/partners/xai/tests/unit_tests/test_chat_models_standard.py index a0d6a5170a8d6..a70718f3224a2 100644 --- a/libs/partners/xai/tests/unit_tests/test_chat_models_standard.py +++ b/libs/partners/xai/tests/unit_tests/test_chat_models_standard.py @@ -3,7 +3,7 @@ from typing import Tuple, Type from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.unit_tests import ( # type: ignore[import-not-found] +from langchain_tests.unit_tests import ( # type: ignore[import-not-found] ChatModelUnitTests, # type: ignore[import-not-found] ) diff --git a/libs/standard-tests/Makefile b/libs/standard-tests/Makefile index a48f80928b993..5283db9a9dc43 100644 --- a/libs/standard-tests/Makefile +++ b/libs/standard-tests/Makefile @@ -25,7 +25,7 @@ PYTHON_FILES=. MYPY_CACHE=.mypy_cache lint format: PYTHON_FILES=. lint_diff format_diff: PYTHON_FILES=$(shell git diff --relative=libs/standard-tests --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$') -lint_package: PYTHON_FILES=langchain_standard_tests +lint_package: PYTHON_FILES=langchain_tests lint_tests: PYTHON_FILES=tests lint_tests: MYPY_CACHE=.mypy_cache_test @@ -44,7 +44,7 @@ spell_check: spell_fix: poetry run codespell --toml pyproject.toml -w -check_imports: $(shell find langchain_standard_tests -name '*.py') +check_imports: $(shell find langchain_tests -name '*.py') poetry run python ./scripts/check_imports.py $^ ###################### diff --git a/libs/standard-tests/README.md b/libs/standard-tests/README.md index 0060203a1e2be..029a9bafb76da 100644 --- a/libs/standard-tests/README.md +++ b/libs/standard-tests/README.md @@ -40,7 +40,7 @@ from typing import Type import pytest from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.unit_tests import ChatModelUnitTests +from langchain_tests.unit_tests import ChatModelUnitTests from langchain_parrot_chain import ChatParrotChain @@ -60,7 +60,7 @@ from typing import Type import pytest from langchain_core.language_models import BaseChatModel -from langchain_standard_tests.integration_tests import ChatModelIntegrationTests +from langchain_tests.integration_tests import ChatModelIntegrationTests from langchain_parrot_chain import ChatParrotChain diff --git a/libs/standard-tests/langchain_standard_tests/__init__.py b/libs/standard-tests/langchain_tests/__init__.py similarity index 100% rename from libs/standard-tests/langchain_standard_tests/__init__.py rename to libs/standard-tests/langchain_tests/__init__.py diff --git a/libs/standard-tests/langchain_standard_tests/base.py b/libs/standard-tests/langchain_tests/base.py similarity index 96% rename from libs/standard-tests/langchain_standard_tests/base.py rename to libs/standard-tests/langchain_tests/base.py index e9f71802737ba..f2b7ca1f7e92d 100644 --- a/libs/standard-tests/langchain_standard_tests/base.py +++ b/libs/standard-tests/langchain_tests/base.py @@ -13,7 +13,7 @@ def test_no_overrides_DO_NOT_OVERRIDE(self) -> None: def explore_bases(cls: Type) -> None: nonlocal comparison_class for base in cls.__bases__: - if base.__module__.startswith("langchain_standard_tests."): + if base.__module__.startswith("langchain_tests."): if comparison_class is None: comparison_class = base else: diff --git a/libs/standard-tests/langchain_standard_tests/integration_tests/__init__.py b/libs/standard-tests/langchain_tests/integration_tests/__init__.py similarity index 90% rename from libs/standard-tests/langchain_standard_tests/integration_tests/__init__.py rename to libs/standard-tests/langchain_tests/integration_tests/__init__.py index ec26de72a4a7e..67ccb38f29e94 100644 --- a/libs/standard-tests/langchain_standard_tests/integration_tests/__init__.py +++ b/libs/standard-tests/langchain_tests/integration_tests/__init__.py @@ -14,9 +14,7 @@ ] for module in modules: - pytest.register_assert_rewrite( - f"langchain_standard_tests.integration_tests.{module}" - ) + pytest.register_assert_rewrite(f"langchain_tests.integration_tests.{module}") from .base_store import BaseStoreAsyncTests, BaseStoreSyncTests from .cache import AsyncCacheTestSuite, SyncCacheTestSuite diff --git a/libs/standard-tests/langchain_standard_tests/integration_tests/base_store.py b/libs/standard-tests/langchain_tests/integration_tests/base_store.py similarity index 99% rename from libs/standard-tests/langchain_standard_tests/integration_tests/base_store.py rename to libs/standard-tests/langchain_tests/integration_tests/base_store.py index e4b461d98227a..cc5fab8bcf7a4 100644 --- a/libs/standard-tests/langchain_standard_tests/integration_tests/base_store.py +++ b/libs/standard-tests/langchain_tests/integration_tests/base_store.py @@ -4,7 +4,7 @@ import pytest from langchain_core.stores import BaseStore -from langchain_standard_tests.base import BaseStandardTests +from langchain_tests.base import BaseStandardTests V = TypeVar("V") diff --git a/libs/standard-tests/langchain_standard_tests/integration_tests/cache.py b/libs/standard-tests/langchain_tests/integration_tests/cache.py similarity index 99% rename from libs/standard-tests/langchain_standard_tests/integration_tests/cache.py rename to libs/standard-tests/langchain_tests/integration_tests/cache.py index 7d1359f5154ec..7087da8ea07b3 100644 --- a/libs/standard-tests/langchain_standard_tests/integration_tests/cache.py +++ b/libs/standard-tests/langchain_tests/integration_tests/cache.py @@ -4,7 +4,7 @@ from langchain_core.caches import BaseCache from langchain_core.outputs import Generation -from langchain_standard_tests.base import BaseStandardTests +from langchain_tests.base import BaseStandardTests class SyncCacheTestSuite(BaseStandardTests): diff --git a/libs/standard-tests/langchain_standard_tests/integration_tests/chat_models.py b/libs/standard-tests/langchain_tests/integration_tests/chat_models.py similarity index 99% rename from libs/standard-tests/langchain_standard_tests/integration_tests/chat_models.py rename to libs/standard-tests/langchain_tests/integration_tests/chat_models.py index 9eea91aebbe44..f0ac13d461443 100644 --- a/libs/standard-tests/langchain_standard_tests/integration_tests/chat_models.py +++ b/libs/standard-tests/langchain_tests/integration_tests/chat_models.py @@ -21,11 +21,11 @@ from pydantic.v1 import BaseModel as BaseModelV1 from pydantic.v1 import Field as FieldV1 -from langchain_standard_tests.unit_tests.chat_models import ( +from langchain_tests.unit_tests.chat_models import ( ChatModelTests, my_adder_tool, ) -from langchain_standard_tests.utils.pydantic import PYDANTIC_MAJOR_VERSION +from langchain_tests.utils.pydantic import PYDANTIC_MAJOR_VERSION class MagicFunctionSchema(BaseModel): diff --git a/libs/standard-tests/langchain_standard_tests/integration_tests/embeddings.py b/libs/standard-tests/langchain_tests/integration_tests/embeddings.py similarity index 96% rename from libs/standard-tests/langchain_standard_tests/integration_tests/embeddings.py rename to libs/standard-tests/langchain_tests/integration_tests/embeddings.py index 1de2aece78023..7e3689d0f5429 100644 --- a/libs/standard-tests/langchain_standard_tests/integration_tests/embeddings.py +++ b/libs/standard-tests/langchain_tests/integration_tests/embeddings.py @@ -2,7 +2,7 @@ from langchain_core.embeddings import Embeddings -from langchain_standard_tests.unit_tests.embeddings import EmbeddingsTests +from langchain_tests.unit_tests.embeddings import EmbeddingsTests class EmbeddingsIntegrationTests(EmbeddingsTests): diff --git a/libs/standard-tests/langchain_standard_tests/integration_tests/indexer.py b/libs/standard-tests/langchain_tests/integration_tests/indexer.py similarity index 100% rename from libs/standard-tests/langchain_standard_tests/integration_tests/indexer.py rename to libs/standard-tests/langchain_tests/integration_tests/indexer.py diff --git a/libs/standard-tests/langchain_standard_tests/integration_tests/tools.py b/libs/standard-tests/langchain_tests/integration_tests/tools.py similarity index 97% rename from libs/standard-tests/langchain_standard_tests/integration_tests/tools.py rename to libs/standard-tests/langchain_tests/integration_tests/tools.py index ad854c3b1d41d..2609a87c84521 100644 --- a/libs/standard-tests/langchain_standard_tests/integration_tests/tools.py +++ b/libs/standard-tests/langchain_tests/integration_tests/tools.py @@ -1,7 +1,7 @@ from langchain_core.messages import ToolCall from langchain_core.tools import BaseTool -from langchain_standard_tests.unit_tests.tools import ToolsTests +from langchain_tests.unit_tests.tools import ToolsTests class ToolsIntegrationTests(ToolsTests): diff --git a/libs/standard-tests/langchain_standard_tests/integration_tests/vectorstores.py b/libs/standard-tests/langchain_tests/integration_tests/vectorstores.py similarity index 99% rename from libs/standard-tests/langchain_standard_tests/integration_tests/vectorstores.py rename to libs/standard-tests/langchain_tests/integration_tests/vectorstores.py index d7735cfdd2bcf..08b0358dcfb9e 100644 --- a/libs/standard-tests/langchain_standard_tests/integration_tests/vectorstores.py +++ b/libs/standard-tests/langchain_tests/integration_tests/vectorstores.py @@ -7,7 +7,7 @@ from langchain_core.embeddings.fake import DeterministicFakeEmbedding, Embeddings from langchain_core.vectorstores import VectorStore -from langchain_standard_tests.base import BaseStandardTests +from langchain_tests.base import BaseStandardTests # Arbitrarily chosen. Using a small embedding size # so tests are faster and easier to debug. diff --git a/libs/standard-tests/langchain_standard_tests/py.typed b/libs/standard-tests/langchain_tests/py.typed similarity index 100% rename from libs/standard-tests/langchain_standard_tests/py.typed rename to libs/standard-tests/langchain_tests/py.typed diff --git a/libs/standard-tests/langchain_standard_tests/unit_tests/__init__.py b/libs/standard-tests/langchain_tests/unit_tests/__init__.py similarity index 86% rename from libs/standard-tests/langchain_standard_tests/unit_tests/__init__.py rename to libs/standard-tests/langchain_tests/unit_tests/__init__.py index df94c79ae61cc..ee4a1700edaf1 100644 --- a/libs/standard-tests/langchain_standard_tests/unit_tests/__init__.py +++ b/libs/standard-tests/langchain_tests/unit_tests/__init__.py @@ -11,7 +11,7 @@ ] for module in modules: - pytest.register_assert_rewrite(f"langchain_standard_tests.unit_tests.{module}") + pytest.register_assert_rewrite(f"langchain_tests.unit_tests.{module}") from .chat_models import ChatModelUnitTests from .embeddings import EmbeddingsUnitTests diff --git a/libs/standard-tests/langchain_standard_tests/unit_tests/chat_models.py b/libs/standard-tests/langchain_tests/unit_tests/chat_models.py similarity index 98% rename from libs/standard-tests/langchain_standard_tests/unit_tests/chat_models.py rename to libs/standard-tests/langchain_tests/unit_tests/chat_models.py index 9bde7fbf3e1a5..f5e5fe54f6e76 100644 --- a/libs/standard-tests/langchain_standard_tests/unit_tests/chat_models.py +++ b/libs/standard-tests/langchain_tests/unit_tests/chat_models.py @@ -22,8 +22,8 @@ ) from syrupy import SnapshotAssertion -from langchain_standard_tests.base import BaseStandardTests -from langchain_standard_tests.utils.pydantic import PYDANTIC_MAJOR_VERSION +from langchain_tests.base import BaseStandardTests +from langchain_tests.utils.pydantic import PYDANTIC_MAJOR_VERSION class Person(BaseModel): # Used by some dependent tests. Should be deprecated. diff --git a/libs/standard-tests/langchain_standard_tests/unit_tests/embeddings.py b/libs/standard-tests/langchain_tests/unit_tests/embeddings.py similarity index 96% rename from libs/standard-tests/langchain_standard_tests/unit_tests/embeddings.py rename to libs/standard-tests/langchain_tests/unit_tests/embeddings.py index 39c6e941c5d7e..da7b78513844b 100644 --- a/libs/standard-tests/langchain_standard_tests/unit_tests/embeddings.py +++ b/libs/standard-tests/langchain_tests/unit_tests/embeddings.py @@ -7,7 +7,7 @@ from langchain_core.embeddings import Embeddings from pydantic import SecretStr -from langchain_standard_tests.base import BaseStandardTests +from langchain_tests.base import BaseStandardTests class EmbeddingsTests(BaseStandardTests): diff --git a/libs/standard-tests/langchain_standard_tests/unit_tests/tools.py b/libs/standard-tests/langchain_tests/unit_tests/tools.py similarity index 97% rename from libs/standard-tests/langchain_standard_tests/unit_tests/tools.py rename to libs/standard-tests/langchain_tests/unit_tests/tools.py index 0decc51230fbf..b92cb4f5263a4 100644 --- a/libs/standard-tests/langchain_standard_tests/unit_tests/tools.py +++ b/libs/standard-tests/langchain_tests/unit_tests/tools.py @@ -7,7 +7,7 @@ from langchain_core.tools import BaseTool from pydantic import SecretStr -from langchain_standard_tests.base import BaseStandardTests +from langchain_tests.base import BaseStandardTests class ToolsTests(BaseStandardTests): diff --git a/libs/standard-tests/langchain_standard_tests/utils/__init__.py b/libs/standard-tests/langchain_tests/utils/__init__.py similarity index 100% rename from libs/standard-tests/langchain_standard_tests/utils/__init__.py rename to libs/standard-tests/langchain_tests/utils/__init__.py diff --git a/libs/standard-tests/langchain_standard_tests/utils/pydantic.py b/libs/standard-tests/langchain_tests/utils/pydantic.py similarity index 100% rename from libs/standard-tests/langchain_standard_tests/utils/pydantic.py rename to libs/standard-tests/langchain_tests/utils/pydantic.py diff --git a/libs/standard-tests/pyproject.toml b/libs/standard-tests/pyproject.toml index 8b1098c000307..238d90b102906 100644 --- a/libs/standard-tests/pyproject.toml +++ b/libs/standard-tests/pyproject.toml @@ -4,8 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "langchain-tests" -packages = [{ include = "langchain_standard_tests" }] -version = "0.3.1" +version = "0.3.2" description = "Standard tests for LangChain implementations" authors = ["Erick Friis "] readme = "README.md" diff --git a/libs/standard-tests/tests/unit_tests/test_in_memory_base_store.py b/libs/standard-tests/tests/unit_tests/test_in_memory_base_store.py index 5171c14c16230..35ad6674bc5a1 100644 --- a/libs/standard-tests/tests/unit_tests/test_in_memory_base_store.py +++ b/libs/standard-tests/tests/unit_tests/test_in_memory_base_store.py @@ -5,7 +5,7 @@ import pytest from langchain_core.stores import InMemoryStore -from langchain_standard_tests.integration_tests.base_store import ( +from langchain_tests.integration_tests.base_store import ( BaseStoreAsyncTests, BaseStoreSyncTests, ) diff --git a/libs/standard-tests/tests/unit_tests/test_in_memory_cache.py b/libs/standard-tests/tests/unit_tests/test_in_memory_cache.py index 4f67a876490d0..6c1a1647ade05 100644 --- a/libs/standard-tests/tests/unit_tests/test_in_memory_cache.py +++ b/libs/standard-tests/tests/unit_tests/test_in_memory_cache.py @@ -1,7 +1,7 @@ import pytest from langchain_core.caches import InMemoryCache -from langchain_standard_tests.integration_tests.cache import ( +from langchain_tests.integration_tests.cache import ( AsyncCacheTestSuite, SyncCacheTestSuite, ) diff --git a/libs/standard-tests/tests/unit_tests/test_in_memory_vectorstore.py b/libs/standard-tests/tests/unit_tests/test_in_memory_vectorstore.py index d1becb40c9eb4..8a3bf5d0a32b2 100644 --- a/libs/standard-tests/tests/unit_tests/test_in_memory_vectorstore.py +++ b/libs/standard-tests/tests/unit_tests/test_in_memory_vectorstore.py @@ -4,7 +4,7 @@ VectorStore, ) -from langchain_standard_tests.integration_tests.vectorstores import ( +from langchain_tests.integration_tests.vectorstores import ( AsyncReadWriteTestSuite, ReadWriteTestSuite, ) From 0a06732d3e3e04a2ccc93b2a8090e6dc42115a35 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 18 Nov 2024 19:25:47 -0800 Subject: [PATCH 13/17] docs: links in integration contrib (#28200) --- .../contributing/how_to/integrations/community.mdx | 10 ++++------ docs/docs/contributing/how_to/integrations/index.mdx | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/docs/contributing/how_to/integrations/community.mdx b/docs/docs/contributing/how_to/integrations/community.mdx index a33ae002cd0d4..c7c3dadef917e 100644 --- a/docs/docs/contributing/how_to/integrations/community.mdx +++ b/docs/docs/contributing/how_to/integrations/community.mdx @@ -1,13 +1,11 @@ -## How to add a community integration (deprecated guide) +## How to add a community integration (not recommended) :::danger -We are no longer accepting new community integrations. Please see the -[main integration guide](./index.mdx) for more information on contributing new -integrations. +We recommend following the [main integration guide](./index.mdx) to add new integrations instead. -Note that `langchain-community` is **not** deprecated. Only -the process for adding new community integrations is deprecated. +If you follow this guide, there is a high likelihood we will close your PR with the above +guide linked without much discussion. ::: diff --git a/docs/docs/contributing/how_to/integrations/index.mdx b/docs/docs/contributing/how_to/integrations/index.mdx index 5f08dce43606e..159f4ac4e999b 100644 --- a/docs/docs/contributing/how_to/integrations/index.mdx +++ b/docs/docs/contributing/how_to/integrations/index.mdx @@ -65,10 +65,10 @@ that will render on this site (https://python.langchain.com/). As a prerequisite to adding your integration to our documentation, you must: -1. Confirm that your integration is in the list of components we are currently accepting. +1. Confirm that your integration is in the [list of components](#components-to-integrate) we are currently accepting. 2. Ensure that your integration is in a separate package that can be installed with `pip install `. -3. Implement the standard tests for your integration and successfully run them. -3. Write documentation for your integration in the `docs/docs/integrations` directory of the LangChain monorepo. +3. [Implement the standard tests](/docs/contributing/how_to/integrations/standard_tests) for your integration and successfully run them. +3. Write documentation for your integration in the `docs/docs/integrations/` directory of the LangChain monorepo. 4. Add a provider page for your integration in the `docs/docs/integrations/providers` directory of the LangChain monorepo. Once you have completed these steps, you can submit a PR to the LangChain monorepo to add your integration to the documentation. From 97f752c92d431d69fcee26cc28e14a775ff2e396 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 18 Nov 2024 19:59:52 -0800 Subject: [PATCH 14/17] docs: more standard test stubs (#28202) --- docs/docs/contributing/how_to/index.mdx | 6 +- .../how_to/integrations/standard_tests.ipynb | 141 +++++++++++++++--- docs/docs/contributing/index.mdx | 1 + 3 files changed, 127 insertions(+), 21 deletions(-) diff --git a/docs/docs/contributing/how_to/index.mdx b/docs/docs/contributing/how_to/index.mdx index e4eda7ddbc1d8..d9f903f4156d6 100644 --- a/docs/docs/contributing/how_to/index.mdx +++ b/docs/docs/contributing/how_to/index.mdx @@ -2,4 +2,8 @@ - [**Documentation**](documentation/index.mdx): Help improve our docs, including this one! - [**Code**](code/index.mdx): Help us write code, fix bugs, or improve our infrastructure. -- [**Integrations**](integrations/index.mdx): Help us integrate with your favorite vendors and tools. \ No newline at end of file + +## Integrations + +- [**Start Here**](integrations/index.mdx): Help us integrate with your favorite vendors and tools. +- [**Standard Tests**](integrations/standard_tests): Ensure your integration passes an expected set of tests. diff --git a/docs/docs/contributing/how_to/integrations/standard_tests.ipynb b/docs/docs/contributing/how_to/integrations/standard_tests.ipynb index ace79d531305f..4607fc83c2147 100644 --- a/docs/docs/contributing/how_to/integrations/standard_tests.ipynb +++ b/docs/docs/contributing/how_to/integrations/standard_tests.ipynb @@ -6,9 +6,7 @@ "source": [ "# How to add standard tests to an integration\n", "\n", - "Implementing standard tests \n", - "\n", - "When creating either a custom class for yourself or a new tool to publish in a LangChain integration, it is important to add standard tests to ensure it works as expected. This guide will show you how to add standard tests to a tool, and the templates for implementing each different kind of integration are linked [at the bottom](#standard-test-templates-per-component).\n", + "When creating either a custom class for yourself or a new tool to publish in a LangChain integration, it is important to add standard tests to ensure it works as expected. This guide will show you how to add standard tests to a tool, and you can **[Skip to the test templates](#standard-test-templates-per-component)** for implementing tests for each integration.\n", "\n", "## Setup\n", "\n", @@ -20,7 +18,7 @@ ":::note\n", "\n", "Because added tests in new versions of `langchain-tests` will always break your CI/CD pipelines, we recommend pinning the \n", - "version of `langchain-tests==0.3.0` to avoid unexpected changes.\n", + "version of `langchain-tests==0.3.2` to avoid unexpected changes.\n", "\n", ":::" ] @@ -31,7 +29,7 @@ "metadata": {}, "outputs": [], "source": [ - "%pip install -U langchain-core langchain-tests==0.3.0 pytest pytest-socket" + "%pip install -U langchain-core langchain-tests==0.3.2 pytest pytest-socket" ] }, { @@ -217,7 +215,11 @@ "class TestChatParrotLinkUnit(ChatModelUnitTests):\n", " @property\n", " def chat_model_class(self) -> Type[ChatParrotLink]:\n", - " return ChatParrotLink" + " return ChatParrotLink\n", + "\n", + " @property\n", + " def chat_model_params(self) -> dict:\n", + " return {\"model\": \"bird-brain-001\", \"temperature\": 0}" ] }, { @@ -248,22 +250,54 @@ "metadata": {}, "source": [ "
\n", - "\n", - "
\n", - "Work in progress:\n", "
\n", - " Retrievers\n", - " TODO" + " Embedding Models" ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ - "
\n", - "
\n", - " Vector Stores\n", - " TODO" + "# title=\"tests/unit_tests/test_embeddings.py\"\n", + "from typing import Tuple, Type\n", + "\n", + "from langchain_parrot_link.embeddings import ParrotLinkEmbeddings\n", + "from langchain_standard_tests.unit_tests import EmbeddingsUnitTests\n", + "\n", + "\n", + "class TestParrotLinkEmbeddingsUnit(EmbeddingsUnitTests):\n", + " @property\n", + " def embeddings_class(self) -> Type[ParrotLinkEmbeddings]:\n", + " return ParrotLinkEmbeddings\n", + "\n", + " @property\n", + " def embedding_model_params(self) -> dict:\n", + " return {\"model\": \"nest-embed-001\", \"temperature\": 0}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# title=\"tests/integration_tests/test_embeddings.py\"\n", + "from typing import Type\n", + "\n", + "from langchain_parrot_link.embeddings import ParrotLinkEmbeddings\n", + "from langchain_standard_tests.integration_tests import EmbeddingsIntegrationTests\n", + "\n", + "\n", + "class TestParrotLinkEmbeddingsIntegration(EmbeddingsIntegrationTests):\n", + " @property\n", + " def embeddings_class(self) -> Type[ParrotLinkEmbeddings]:\n", + " return ParrotLinkEmbeddings\n", + "\n", + " @property\n", + " def embedding_model_params(self) -> dict:\n", + " return {\"model\": \"nest-embed-001\", \"temperature\": 0}" ] }, { @@ -272,16 +306,83 @@ "source": [ "
\n", "
\n", - " Embedding Models\n", - " TODO" + " Tools/Toolkits\n", + " Note: The standard tests for tools/toolkits are implemented in the example in the main body of this guide too." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# title=\"tests/unit_tests/test_tools.py\"\n", + "from typing import Type\n", + "\n", + "from langchain_parrot_link.tools import ParrotMultiplyTool\n", + "from langchain_standard_tests.unit_tests import ToolsUnitTests\n", + "\n", + "\n", + "class TestParrotMultiplyToolUnit(ToolsUnitTests):\n", + " @property\n", + " def tool_constructor(self) -> Type[ParrotMultiplyTool]:\n", + " return ParrotMultiplyTool\n", + "\n", + " def tool_constructor_params(self) -> dict:\n", + " # if your tool constructor instead required initialization arguments like\n", + " # `def __init__(self, some_arg: int):`, you would return those here\n", + " # as a dictionary, e.g.: `return {'some_arg': 42}`\n", + " return {}\n", + "\n", + " def tool_invoke_params_example(self) -> dict:\n", + " \"\"\"\n", + " Returns a dictionary representing the \"args\" of an example tool call.\n", + "\n", + " This should NOT be a ToolCall dict - i.e. it should not\n", + " have {\"name\", \"id\", \"args\"} keys.\n", + " \"\"\"\n", + " return {\"a\": 2, \"b\": 3}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# title=\"tests/integration_tests/test_tools.py\"\n", + "from typing import Type\n", + "\n", + "from langchain_parrot_link.tools import ParrotMultiplyTool\n", + "from langchain_standard_tests.integration_tests import ToolsIntegrationTests\n", + "\n", + "\n", + "class TestParrotMultiplyToolIntegration(ToolsIntegrationTests):\n", + " @property\n", + " def tool_constructor(self) -> Type[ParrotMultiplyTool]:\n", + " return ParrotMultiplyTool\n", + "\n", + " def tool_constructor_params(self) -> dict:\n", + " # if your tool constructor instead required initialization arguments like\n", + " # `def __init__(self, some_arg: int):`, you would return those here\n", + " # as a dictionary, e.g.: `return {'some_arg': 42}`\n", + " return {}\n", + "\n", + " def tool_invoke_params_example(self) -> dict:\n", + " \"\"\"\n", + " Returns a dictionary representing the \"args\" of an example tool call.\n", + "\n", + " This should NOT be a ToolCall dict - i.e. it should not\n", + " have {\"name\", \"id\", \"args\"} keys.\n", + " \"\"\"\n", + " return {\"a\": 2, \"b\": 3}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "
\n", - "
" + "" ] } ], diff --git a/docs/docs/contributing/index.mdx b/docs/docs/contributing/index.mdx index 67930710585dc..d2c1231789d8d 100644 --- a/docs/docs/contributing/index.mdx +++ b/docs/docs/contributing/index.mdx @@ -17,6 +17,7 @@ More coming soon! We are working on tutorials to help you make your first contri - [**Documentation**](how_to/documentation/index.mdx): Help improve our docs, including this one! - [**Code**](how_to/code/index.mdx): Help us write code, fix bugs, or improve our infrastructure. - [**Integrations**](how_to/integrations/index.mdx): Help us integrate with your favorite vendors and tools. +- [**Standard Tests**](how_to/integrations/standard_tests): Ensure your integration passes an expected set of tests. ## Reference From 5599a0a537802a2b9083ee7d7e50311167b42f33 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Tue, 19 Nov 2024 09:20:25 -0500 Subject: [PATCH 15/17] core[minor]: Add other langgraph packages to sys_info (#28190) Add other langgraph packages to sys_info output --- libs/core/langchain_core/sys_info.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/core/langchain_core/sys_info.py b/libs/core/langchain_core/sys_info.py index f70df1f631864..532b4e63802ed 100644 --- a/libs/core/langchain_core/sys_info.py +++ b/libs/core/langchain_core/sys_info.py @@ -47,7 +47,6 @@ def print_sys_info(*, additional_pkgs: Sequence[str] = ()) -> None: # Packages that do not start with "langchain" prefix. other_langchain_packages = [ "langserve", - "langgraph", "langsmith", ] @@ -55,8 +54,17 @@ def print_sys_info(*, additional_pkgs: Sequence[str] = ()) -> None: name for _, name, _ in pkgutil.iter_modules() if name.startswith("langchain") ] + langgraph_pkgs = [ + name for _, name, _ in pkgutil.iter_modules() if name.startswith("langgraph") + ] + all_packages = sorted( - set(langchain_pkgs + other_langchain_packages + list(additional_pkgs)) + set( + langchain_pkgs + + langgraph_pkgs + + other_langchain_packages + + list(additional_pkgs) + ) ) # Always surface these packages to the top From 197b885911764fc71adccdc21ac71d85d7eac776 Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:31:56 -0800 Subject: [PATCH 16/17] [CLI] Relax constraints (#28218) --- libs/cli/poetry.lock | 5 +++-- libs/cli/pyproject.toml | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/cli/poetry.lock b/libs/cli/poetry.lock index 6005737416919..9c4fbdc15530c 100644 --- a/libs/cli/poetry.lock +++ b/libs/cli/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "annotated-types" @@ -270,6 +270,7 @@ description = "Python bindings for GritQL" optional = false python-versions = "<4.0,>=3.8" files = [ + {file = "gritql-0.1.4-py2.py3-none-any.whl", hash = "sha256:a71d27c2bfb904d0150ccb0c28878ef640940b9540b6f1ef964133be1ddcb0e7"}, {file = "gritql-0.1.4-py3-none-any.whl", hash = "sha256:6e9f8c638bbf3dda58222832c976c716a1ca02a920e7549df58bf1a0bb9ebeef"}, {file = "gritql-0.1.4.tar.gz", hash = "sha256:487d0c1a98cb17cc9681121e53ac15f39e1cb87c4317a2ca1872e33d3d3a0a47"}, ] @@ -1365,4 +1366,4 @@ serve = [] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "733676371ee89686b906db3bc190d39128fb664bf34d9b3ccd66aac75c8cc2aa" +content-hash = "ed6ba14db90499ff27fefaab277bb8b879a48e024f4dabf944d76d8f7375002b" diff --git a/libs/cli/pyproject.toml b/libs/cli/pyproject.toml index 0a5804351d844..2187cbc936546 100644 --- a/libs/cli/pyproject.toml +++ b/libs/cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langchain-cli" -version = "0.0.31" +version = "0.0.32" description = "CLI for interacting with LangChain" authors = ["Erick Friis "] readme = "README.md" @@ -14,10 +14,10 @@ license = "MIT" [tool.poetry.dependencies] python = ">=3.9,<4.0" typer = { extras = ["all"], version = "^0.9.0" } -gitpython = "^3.1.40" +gitpython = "^3" langserve = { extras = ["all"], version = ">=0.0.51" } -uvicorn = "^0.23.2" -tomlkit = "^0.12.2" +uvicorn = ">=0.23,<1.0" +tomlkit = ">=0.12" gritql = "^0.1.1" [tool.poetry.scripts] From 6bda89f9a18be92340bfb0fcc13050ab2c4c9695 Mon Sep 17 00:00:00 2001 From: Lance Martin <122662504+rlancemartin@users.noreply.github.com> Date: Tue, 19 Nov 2024 12:59:10 -0800 Subject: [PATCH 17/17] Clarify bind tools takes a list (#28222) Thank you for contributing to LangChain! - [ ] **PR title**: "package: description" - Where "package" is whichever of langchain, community, core, etc. is being modified. Use "docs: ..." for purely docs changes, "infra: ..." for CI changes. - Example: "community: add foobar LLM" - [ ] **PR message**: ***Delete this entire checklist*** and replace with - **Description:** a description of the change - **Issue:** the issue # it fixes, if applicable - **Dependencies:** any dependencies required for this change - **Twitter handle:** if your PR gets announced, and you'd like a mention, we'll gladly shout you out! - [ ] **Add tests and docs**: If you're adding a new integration, please include 1. a test for the integration, preferably unit tests that do not rely on network access, 2. an example notebook showing its use. It lives in `docs/docs/integrations` directory. - [ ] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/ Additional guidelines: - Make sure optional dependencies are imported within a function. - Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests. - Most PRs should not touch more than one package. - Changes should be backwards compatible. - If you are adding something to community, do not re-import it in langchain. If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17. --- docs/docs/concepts/tool_calling.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/concepts/tool_calling.mdx b/docs/docs/concepts/tool_calling.mdx index 438c52ccb25a6..353eb69170ae0 100644 --- a/docs/docs/concepts/tool_calling.mdx +++ b/docs/docs/concepts/tool_calling.mdx @@ -77,7 +77,7 @@ The central concept to understand is that LangChain provides a standardized inte The `.bind_tools()` method can be used to specify which tools are available for a model to call. ```python -model_with_tools = model.bind_tools([tools_list]) +model_with_tools = model.bind_tools(tools_list) ``` As a specific example, let's take a function `multiply` and bind it as a tool to a model that supports tool calling.