LangGraph announced that it has further enhanced its memory capabilities by adding semantic search capabilities to BaseStore. According to the LangChain blog, this new feature is now accessible on all LangGraph Cloud distributions, as well as the open source PostgresStore and InMemoryStore.
Why semantic search?
The inclusion of semantic search addresses the need for more sophisticated search methods for unstructured information within the LangGraph framework. Unlike traditional filtering methods that rely on exact matches, semantic search allows agents to retrieve information based on meaning. This is especially useful for remembering user preferences, learning from past interactions, and maintaining consistent knowledge.
Implementation details
BaseStore’s search and asynchronous search (asearch) methods now support natural language query terms. If your repository supports this feature, documents are scored and returned based on semantic similarity. InMemoryStore and PostgresStore have integrated this functionality for development and production environments respectively.
For LangGraph platform users, you can configure your server to include new items via repository configuration in the langgraph.json file. Key configuration options include ‘include’ providers, dimension sizes, and fields to index.
Migration and Customization
Current users of the LangGraph memory store can integrate semantic search without disrupting existing tasks. LangGraph OSS users can use this feature by setting up a PostGresStore with an index configuration. LangGraph platform users can add an index configuration to their deployment to index new documents for search based on semantic similarity.
For those who don’t want to use LangChain’s default embeddings, you can also define custom embedding logic. This involves creating user-defined functions and referencing them in configuration files.
next steps
LangGraph has updated its documentation and templates to include examples of real-world semantic searches. Users are encouraged to try out new features and provide feedback on GitHub. For more conceptual information about AI memory, LangGraph provides detailed documentation on its website.
For more information about the semantic search feature, visit the LangChain blog.
Image source: Shutterstock