Skip to content

The agent engineering platform.

docs[patch]: update contributor docs for integrations (#28576)

ccurme15cbc36a2379
diff --git a/docs/docs/contributing/how_to/integrations/package.mdx b/docs/docs/contributing/how_to/integrations/package.mdx
index d016ff1bed..5a4aa697c2 100644
--- a/docs/docs/contributing/how_to/integrations/package.mdx
+++ b/docs/docs/contributing/how_to/integrations/package.mdx
@@ -37,14 +37,11 @@ import CodeBlock from '@theme/CodeBlock';
Refer to the [Custom Chat Model Guide](/docs/how_to/custom_chat_model) guide for
detail on a starter chat model [implementation](/docs/how_to/custom_chat_model/#implementation).
- :::tip
-
- The model from the [Custom Chat Model Guide](/docs/how_to/custom_chat_model) is tested
- against the standard unit and integration tests in the LangChain Github repository.
- You can also access that implementation directly from Github
- [here](https://github.com/langchain-ai/langchain/blob/master/libs/standard-tests/tests/unit_tests/custom_chat_model.py).
-
- :::
+ The `langchain-cli` package contains [template integrations](https://github.com/langchain-ai/langchain/tree/master/libs/cli/langchain_cli/integration_template/integration_template)
+ for major LangChain components that are tested against the standard unit and
+ integration tests in the LangChain Github repository. You can access the starter
+ chat model implementation [here](https://github.com/langchain-ai/langchain/blob/master/libs/cli/langchain_cli/integration_template/integration_template/chat_models.py).
+ For convenience, we also include the code below.
<details>
<summary>Example chat model code</summary>
@@ -118,9 +115,6 @@ import VectorstoreSource from '../../../../src/theme/integration_template/integr
</TabItem>
<TabItem value="embeddings" label="Embeddings">
- <details>
- <summary>Example embeddings code</summary>
-
Embeddings are used to convert `str` objects from `Document.page_content` fields
into a vector representation (represented as a list of floats).
@@ -154,9 +148,16 @@ implement this method to handle that.
`embed_documents` takes in a list of strings and returns a list of embeddings as a list of lists of floats.
+### Implementation
-### Async methods
+The `langchain-cli` package contains [template integrations](https://github.com/langchain-ai/langchain/tree/master/libs/cli/langchain_cli/integration_template/integration_template)
+for major LangChain components that are tested against the standard unit and
+integration tests in the LangChain Github repository. You can access the starter
+embedding model implementation [here](https://github.com/langchain-ai/langchain/blob/master/libs/cli/langchain_cli/integration_template/integration_template/embeddings.py).
+For convenience, we also include the code below.
+ <details>
+ <summary>Example embeddings code</summary>
import EmbeddingsSource from '/src/theme/integration_template/integration_template/embeddings.py';
diff --git a/docs/docs/contributing/how_to/integrations/standard_tests.ipynb b/docs/docs/contributing/how_to/integrations/standard_tests.ipynb
index a01dc8a60a..dbf1a1a9b1 100644
--- a/docs/docs/contributing/how_to/integrations/standard_tests.ipynb
+++ b/docs/docs/contributing/how_to/integrations/standard_tests.ipynb
@@ -324,6 +324,28 @@
" <summary>Embedding Models</summary>"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "To configure standard tests for an embeddings model, we subclass\n",
+ "`EmbeddingsUnitTests` and `EmbeddingsIntegrationTests`. On each subclass, we\n",
+ "implement the `embeddings_class` property to specify the embeddings model to be\n",
+ "tested. We can also override the embedding_model_params property to specify\n",
+ "initialization parameters. See examples below.\n",
+ "\n",
+ ":::note\n",
+ "\n",
+ "Details on what tests are run, how each test can be skipped, and troubleshooting tips for each test can be found in the API references. See details:\n",
+ "\n",
+ "- [Unit tests API reference](https://python.langchain.com/api_reference/standard_tests/unit_tests/langchain_tests.unit_tests.embeddings.EmbeddingsUnitTests.html)\n",
+ "- [Integration tests API reference](https://python.langchain.com/api_reference/standard_tests/integration_tests/langchain_tests.integration_tests.embeddings.EmbeddingsIntegrationTests.html)\n",
+ "\n",
+ ":::\n",
+ "\n",
+ "Unit test example:"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -347,6 +369,13 @@
" return {\"model\": \"nest-embed-001\", \"temperature\": 0}"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Integration test example:"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,