The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
docs[patch]: Adds first kv store doc matching new template (#24844)
Jacob Lee21eb4c9e5d7f
diff --git a/docs/docs/integrations/stores/in_memory.ipynb b/docs/docs/integrations/stores/in_memory.ipynbindex aa5e35ef07..6288a1dabd 100644--- a/docs/docs/integrations/stores/in_memory.ipynb+++ b/docs/docs/integrations/stores/in_memory.ipynb@@ -2,12 +2,14 @@"cells": [{"cell_type": "raw",- "metadata": {},+ "metadata": {+ "vscode": {+ "languageId": "raw"+ }+ },"source": ["---\n",- "sidebar_label: In Memory\n",- "sidebar_position: 2\n",- "keywords: [InMemoryStore]\n",+ "sidebar_label: InMemoryByteStore\n","---"]},@@ -17,42 +19,150 @@"source": ["# InMemoryByteStore\n","\n",- "The `InMemoryByteStore` is a non-persistent implementation of `ByteStore` that stores everything in a Python dictionary."+ "This guide will help you get started with in-memory [key-value stores](/docs/concepts/#key-value-stores). For detailed documentation of all `InMemoryByteStore` features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/stores/langchain_core.stores.InMemoryByteStore.html).\n",+ "\n",+ "## Overview\n",+ "\n",+ "The `InMemoryByteStore` is a non-persistent implementation of a `ByteStore` that stores everything in a Python dictionary. It's intended for demos and cases where you don't need persistence past the lifetime of the Python process.\n",+ "\n",+ "### Integration details\n",+ "\n",+ "| Class | Package | Local | [JS support](https://js.langchain.com/v0.2/docs/integrations/stores/in_memory/) | Package downloads | Package latest |\n",+ "| :--- | :--- | :---: | :---: | :---: | :---: | :---: |\n",+ "| [InMemoryByteStore](https://api.python.langchain.com/en/latest/stores/langchain_core.stores.InMemoryByteStore.html) | [langchain_core](https://api.python.langchain.com/en/latest/core_api_reference.html) | ✅ | ✅ |  |  |"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "### Installation\n",+ "\n",+ "The LangChain `InMemoryByteStore` integration lives in the `langchain_core` package:"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {},+ "outputs": [],+ "source": [+ "%pip install -qU langchain_core"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "## Instantiation\n",+ "\n",+ "Now you can instantiate your byte store:"]},{"cell_type": "code","execution_count": 1,"metadata": {},+ "outputs": [],+ "source": [+ "from langchain_core.stores import InMemoryByteStore\n",+ "\n",+ "kv_store = InMemoryByteStore()"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "## Usage\n",+ "\n",+ "You can set data under keys like this using the `mset` method:"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": 2,+ "metadata": {},"outputs": [{- "name": "stdout",- "output_type": "stream",- "text": [- "[b'v1', b'v2']\n"- ]+ "data": {+ "text/plain": [+ "[b'value1', b'value2']"+ ]+ },+ "execution_count": 2,+ "metadata": {},+ "output_type": "execute_result"}],"source": [- "from langchain.storage import InMemoryByteStore\n",- "\n",- "store = InMemoryByteStore()\n",+ "kv_store.mset(\n",+ " [\n",+ " [\"key1\", b\"value1\"],\n",+ " [\"key2\", b\"value2\"],\n",+ " ]\n",+ ")\n","\n",- "store.mset([(\"k1\", b\"v1\"), (\"k2\", b\"v2\")])\n",- "print(store.mget([\"k1\", \"k2\"]))"+ "kv_store.mget(\n",+ " [\n",+ " \"key1\",\n",+ " \"key2\",\n",+ " ]\n",+ ")"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "And you can delete data using the `mdelete` method:"]},{"cell_type": "code",- "execution_count": null,+ "execution_count": 3,"metadata": {},- "outputs": [],- "source": []+ "outputs": [+ {+ "data": {+ "text/plain": [+ "[None, None]"+ ]+ },+ "execution_count": 3,+ "metadata": {},+ "output_type": "execute_result"+ }+ ],+ "source": [+ "kv_store.mdelete(\n",+ " [\n",+ " \"key1\",\n",+ " \"key2\",\n",+ " ]\n",+ ")\n",+ "\n",+ "kv_store.mget(\n",+ " [\n",+ " \"key1\",\n",+ " \"key2\",\n",+ " ]\n",+ ")"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "## API reference\n",+ "\n",+ "For detailed documentation of all `InMemoryByteStore` features and configurations, head to the API reference: https://api.python.langchain.com/en/latest/stores/langchain_core.stores.InMemoryByteStore.html"+ ]}],"metadata": {"kernelspec": {- "display_name": ".venv",+ "display_name": "Python 3","language": "python","name": "python3"},@@ -66,7 +176,7 @@"name": "python","nbconvert_exporter": "python","pygments_lexer": "ipython3",- "version": "3.11.4"+ "version": "3.10.5"}},"nbformat": 4,diff --git a/libs/cli/langchain_cli/integration_template/docs/kv_store.ipynb b/libs/cli/langchain_cli/integration_template/docs/kv_store.ipynbindex f346a17d78..eed689016c 100644--- a/libs/cli/langchain_cli/integration_template/docs/kv_store.ipynb+++ b/libs/cli/langchain_cli/integration_template/docs/kv_store.ipynb@@ -21,7 +21,7 @@"\n","- TODO: Make sure API reference link is correct.\n","\n",- "This will help you getting started with __ModuleName__ [key-value stores](/docs/concepts/#key-value-stores). For detailed documentation of all __ModuleName__ByteStore features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/stores/langchain_core.stores.__module_name__ByteStore.html).\n",+ "This will help you get started with __ModuleName__ [key-value stores](/docs/concepts/#key-value-stores). For detailed documentation of all __ModuleName__ByteStore features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/stores/langchain_core.stores.__module_name__ByteStore.html).\n","\n","- TODO: Add any other relevant links, like information about models, prices, context windows, etc. See https://python.langchain.com/v0.2/docs/integrations/stores/in_memory/ for an example.\n","\n",@@ -113,7 +113,9 @@"source": ["## Usage\n","\n",- "- TODO: Run cells so output can be seen."+ "- TODO: Run cells so output can be seen.\n",+ "\n",+ "You can set data under keys like this using the `mset` method:"]},{@@ -122,15 +124,26 @@"metadata": {},"outputs": [],"source": [- "kv_store.mset([\n",- " [\"key1\", b\"value1\"],\n",- " [\"key2\", b\"value2\"],\n",- "])\n",- "\n",- "kv_store.mget([\n",- " \"key1\",\n",- " \"key2\",\n",- "])"+ "kv_store.mset(\n",+ " [\n",+ " [\"key1\", b\"value1\"],\n",+ " [\"key2\", b\"value2\"],\n",+ " ]\n",+ ")\n",+ "\n",+ "kv_store.mget(\n",+ " [\n",+ " \"key1\",\n",+ " \"key2\",\n",+ " ]\n",+ ")"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "And you can delete data using the `mdelete` method:"]},{@@ -139,15 +152,19 @@"metadata": {},"outputs": [],"source": [- "kv_store.mdelete([\n",- " \"key1\",\n",- " \"key2\",\n",- "])\n",- "\n",- "kv_store.mget([\n",- " \"key1\",\n",- " \"key2\",\n",- "])"+ "kv_store.mdelete(\n",+ " [\n",+ " \"key1\",\n",+ " \"key2\",\n",+ " ]\n",+ ")\n",+ "\n",+ "kv_store.mget(\n",+ " [\n",+ " \"key1\",\n",+ " \"key2\",\n",+ " ]\n",+ ")"]},{@@ -165,7 +182,7 @@"source": ["## API reference\n","\n",- "For detailed documentation of all __ModuleName__ByteStore features and configurations head to the API reference: https://api.python.langchain.com/en/latest/stores/__module_name__.stores.__ModuleName__ByteStore.html"+ "For detailed documentation of all __ModuleName__ByteStore features and configurations, head to the API reference: https://api.python.langchain.com/en/latest/stores/__module_name__.stores.__ModuleName__ByteStore.html"]}],