Setup
To access Oceanbase vector stores you’ll need to deploy a standalone OceanBase server: %docker run —name=ob433 -e MODE=mini -e OB_SERVER_IP=127.0.0.1 -p 2881:2881 -d quay.io/oceanbase/oceanbase-ce:4.3.3.1-101000012024102216 And install thelangchain-oceanbase integration package.
pip install -qU “langchain-oceanbase”
Check the connection to OceanBase and set the memory usage ratio for vector data:
Initialization
Configure the API key of the embedded model. Here we useDashScopeEmbeddings as an example. When deploying Oceanbase with a Docker image as described above, simply follow the script below to set the host, port, user, password, and database name. For other deployment methods, set these parameters according to the actual situation.
pip install dashscope
Manage vector store
Add items to vector store
- TODO: Edit and then run code cell to generate output
Update items in vector store
Delete items from vector store
Query vector store
Once your vector store has been created and the relevant documents have been added you will most likely wish to query it during the running of your chain or agent.Query directly
Performing a simple similarity search can be done as follows:Query by turning into retriever
You can also transform the vector store into a retriever for easier usage in your chains.Usage for retrieval-augmented generation
For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:API reference
For detailed documentation of all OceanbaseVectorStore features and configurations head to the API reference: python.langchain.com/docs/integrations/vectorstores/oceanbaseConnect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.