diff --git a/docs/docs/concepts/persistence.md b/docs/docs/concepts/persistence.md index 6637fbee0..e3f3c05cc 100644 --- a/docs/docs/concepts/persistence.md +++ b/docs/docs/concepts/persistence.md @@ -412,7 +412,22 @@ for update in graph.stream( print(update) ``` -When we use the LangGraph API, either locally (e.g., in LangGraph Studio) or with LangGraph Cloud, the base store is available to use by default and does not need to be specified during graph compilation. For cloud deployments, semantic search is automatically configured based on your `langgraph.json` settings. See the [deployment guide](../deployment/semantic_search.md) for more details. +When we use the LangGraph Platform, either locally (e.g., in LangGraph Studio) or with LangGraph Cloud, the base store is available to use by default and does not need to be specified during graph compilation. To enable semantic search, however, you **do** need to configure the indexing settings in your `langgraph.json` file. For example: + +```json +{ + ... + "store": { + "index": { + "embed": "openai:text-embeddings-3-small", + "dims": 1536, + "fields": ["$"] + } + } +} +``` + +See the [deployment guide](../deployment/semantic_search.md) for more details and configuration options. ## Checkpointer libraries diff --git a/libs/checkpoint-postgres/langgraph/store/postgres/aio.py b/libs/checkpoint-postgres/langgraph/store/postgres/aio.py index cbdd4cfc1..4a516557a 100644 --- a/libs/checkpoint-postgres/langgraph/store/postgres/aio.py +++ b/libs/checkpoint-postgres/langgraph/store/postgres/aio.py @@ -99,6 +99,11 @@ class AsyncPostgresStore(AsyncBatchedBaseStore, BasePostgresStore[_ainternal.Con 1. Call `setup()` before first use to create necessary tables and indexes 2. Have the pgvector extension available to use vector search 3. Use Python 3.10+ for async functionality + + Note: + Semantic search is disabled by default. You can enable it by providing an `index` configuration + when creating the store. Without this configuration, all `index` arguments passed to + `put` or `aput`will have no effect. """ __slots__ = ( diff --git a/libs/checkpoint-postgres/langgraph/store/postgres/base.py b/libs/checkpoint-postgres/langgraph/store/postgres/base.py index d0fd58da5..839b2429e 100644 --- a/libs/checkpoint-postgres/langgraph/store/postgres/base.py +++ b/libs/checkpoint-postgres/langgraph/store/postgres/base.py @@ -573,7 +573,11 @@ class PostgresStore(BaseStore, BasePostgresStore[_pg_internal.Conn]): # Search by similarity results = store.search(("docs",), query="python programming") - ``` + + Note: + Semantic search is disabled by default. You can enable it by providing an `index` configuration + when creating the store. Without this configuration, all `index` arguments passed to + `put` or `aput`will have no effect. Warning: Make sure to call `setup()` before first use to create necessary tables and indexes. diff --git a/libs/checkpoint/langgraph/store/base/__init__.py b/libs/checkpoint/langgraph/store/base/__init__.py index 6406527d3..b2ab49527 100644 --- a/libs/checkpoint/langgraph/store/base/__init__.py +++ b/libs/checkpoint/langgraph/store/base/__init__.py @@ -471,7 +471,11 @@ class InvalidNamespaceError(ValueError): class IndexConfig(TypedDict, total=False): - """Configuration for indexing documents for semantic search in the store.""" + """Configuration for indexing documents for semantic search in the store. + + If not provided to the store, the store will not support vector search. + In that case, all `index` arguments to put() and `aput()` operations will be ignored. + """ dims: int """Number of dimensions in the embedding vectors. @@ -595,6 +599,15 @@ class BaseStore(ABC): Stores enable persistence and memory that can be shared across threads, scoped to user IDs, assistant IDs, or other arbitrary namespaces. + Some implementations may support semantic search capabilities through + an optional `index` configuration. + + Note: + Semantic search capabilities vary by implementation and are typically + disabled by default. Stores that support this feature can be configured + by providing an `index` configuration at creation time. Without this + configuration, semantic search is disabled and any `index` arguments + to storage operations will have no effect. """ __slots__ = ("__weakref__",) diff --git a/libs/checkpoint/langgraph/store/memory/__init__.py b/libs/checkpoint/langgraph/store/memory/__init__.py index d2786db48..ff2d53592 100644 --- a/libs/checkpoint/langgraph/store/memory/__init__.py +++ b/libs/checkpoint/langgraph/store/memory/__init__.py @@ -154,6 +154,11 @@ class InMemoryStore(BaseStore): # Search by similarity results = store.search(("docs",), query="python programming") + Note: + Semantic search is disabled by default. You can enable it by providing an `index` configuration + when creating the store. Without this configuration, all `index` arguments passed to + `put` or `aput`will have no effect. + Warning: This store keeps all data in memory. Data is lost when the process exits. For persistence, use a database-backed store like PostgresStore.