OceanBase has provided native vector database capabilities since version V4.3.3, including vector data storage, indexing, and embedding retrieval - enabling efficient storage and querying of vectorized data.
Dify is an open-source Large Language Model (LLM) application development platform. Combining Backend as Service (BaaS) and LLMOps concepts, it enables developers to quickly build production-ready generative AI applications. Even non-technical users can participate in defining AI applications and managing data operations.
Dify includes essential technologies for building LLM applications: support for hundreds of models, an intuitive prompt orchestration interface, a high-quality RAG engine, a robust agent framework, flexible workflow orchestration, along with user-friendly interfaces and APIs. This eliminates redundant development efforts, enabling developers to focus on innovation and business needs.
This topic demonstrates how to integrate OceanBase Cloud's vector search capabilities with Dify's AI application platform.
Prerequisites
A transactional cluster instance of the MySQL compatible mode is available in your environment.
To use a cluster instance, you first need to create a tenant by referring to Create a tenant.
You have created a MySQL-compatible tenant, a database, and an account, and granted the read and write permissions to the database account. For more information, see Create an account and Create a database (MySQL compatible mode).
You have been granted the project admin or instance admin role to perform read and write operations on instances in the project. If you do not have the required permissions, contact the organization admin.
This integration tutorial runs on Docker container platform. Ensure you have set up the Docker platform.
Deploy Dify
For Dify deployment, refer to Docker Compose Deployment with these modifications:
- Change the
VECTOR_STOREvariable value tooceanbasein.envfile. - Start services using
docker compose --profile oceanbase up -d.
Use Dify
Step 1: Obtain the database connection information
Log in to the OceanBase Cloud console.
In the instance list page, expand the the information of the target instance.
Select Connect > Get Connection String under the target tenant.
In the pop-up window, select Public Network as the connection method.
Follow the prompts in the pop-up window to obtain the public endpoint and the connection string.
Step 2: Connect Large Language Model
For connecting LLMs in Dify, refer to Model.