Skip to content

Commit

Permalink
docs: integration asyncio mode (#28306)
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis authored Nov 23, 2024
1 parent 39fd0fd commit a329647
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/docs/contributing/how_to/integrations/package.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ We recommended pinning these to the latest version: <img src="https://img.shield
Note: Replace `<latest_version>` with the latest version of `langchain-tests` below.

```bash
poetry add --group test pytest pytest-socket langchain-tests==<latest_version>
poetry add --group test pytest pytest-socket pytest-asyncio langchain-tests==<latest_version>
```

And finally, have poetry set up a virtual environment with your dependencies, as well
Expand Down
30 changes: 20 additions & 10 deletions docs/docs/contributing/how_to/integrations/standard_tests.ipynb
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"cell_type": "raw",
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"pagination_next: contributing/how_to/integrations/publish\n",
"pagination_prev: contributing/how_to/integrations/package\n",
"---\n",
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# How to add standard tests to an integration\n",
"\n",
"When creating either a custom class for yourself or 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 custom chat model, and you can **[Skip to the test templates](#standard-test-templates-per-component)** for implementing tests for each integration type.\n",
Expand Down Expand Up @@ -37,13 +47,13 @@
"\n",
"```bash\n",
"poetry add langchain-core\n",
"poetry add --group test pytest pytest-socket langchain-tests==<latest_version>\n",
"poetry add --group test pytest pytest-socket pytest-asyncio langchain-tests==<latest_version>\n",
"poetry install --with test\n",
"```\n",
" </TabItem>\n",
" <TabItem value=\"pip\" label=\"Pip\">\n",
"```bash\n",
"pip install -U langchain-core pytest pytest-socket langchain-tests\n",
"pip install -U langchain-core pytest pytest-socket pytest-asyncio langchain-tests\n",
"\n",
"# install current package in editable mode\n",
"pip install --editable .\n",
Expand Down Expand Up @@ -160,21 +170,21 @@
"\n",
"```bash\n",
"# run unit tests without network access\n",
"poetry run pytest --disable-socket --allow-unix-socket tests/unit_tests\n",
"poetry run pytest --disable-socket --allow-unix-socket --asyncio-mode=auto tests/unit_tests\n",
"\n",
"# run integration tests\n",
"poetry run pytest tests/integration_tests\n",
"poetry run pytest --asyncio-mode=auto tests/integration_tests\n",
"```\n",
"\n",
" </TabItem>\n",
" <TabItem value=\"pip\" label=\"Pip\">\n",
"\n",
"```bash\n",
"# run unit tests without network access\n",
"pytest --disable-socket --allow-unix-socket tests/unit_tests\n",
"pytest --disable-socket --allow-unix-socket --asyncio-mode=auto tests/unit_tests\n",
"\n",
"# run integration tests\n",
"pytest tests/integration_tests\n",
"pytest --asyncio-mode=auto tests/integration_tests\n",
"```\n",
"\n",
" </TabItem>\n",
Expand Down Expand Up @@ -300,7 +310,7 @@
"\n",
" @property\n",
" def embedding_model_params(self) -> dict:\n",
" return {\"model\": \"nest-embed-001\", \"temperature\": 0}"
" return {\"model\": \"nest-embed-001\"}"
]
},
{
Expand Down

0 comments on commit a329647

Please sign in to comment.