Skip to main content

llama-index vector-stores oceanbase integration

Project description

LlamaIndex Vector-Stores Integration: Oceanbase

OceanBase Database is a distributed relational database. It is developed entirely by Ant Group. The OceanBase Database is built on a common server cluster. Based on the Paxos protocol and its distributed structure, the OceanBase Database provides high availability and linear scalability.

OceanBase currently has the ability to store vectors. Users can easily perform the following operations with SQL:

  • Create a table containing vector type fields;
  • Create a vector index table based on the HNSW algorithm;
  • Perform vector approximate nearest neighbor queries;
  • ...

Limitations

The vector storage capability of OceanBase is still being enhanced, and currently has the following limitations:

  • Cosine vector distance function is not yet supported for vector index. Currently only inner product distance and Euclidean distance are supported, and Euclidean distance is used by default.
  • It should be noted that OceanBase currently only supports post-filtering (i.e., filtering based on metadata after performing an approximate nearest neighbor search).

Install dependencies

We use pyobvector to integrate OceanBase vector store into LlamaIndex. So it is necessary to install it with pip install pyobvector before starting.

Setup OceanBase

We recommend using Docker to deploy OceanBase:

docker run --name=ob433 -e MODE=slim -p 2881:2881 -d oceanbase/oceanbase-ce:4.3.3.0-100000142024101215

Usage

%pip install llama-index-vector-stores-oceanbase
%pip install llama-index
# choose dashscope as embedding and llm model, your can also use default openai or other model to test
%pip install llama-index-embeddings-dashscope
%pip install llama-index-llms-dashscope
from llama_index.vector_stores.oceanbase import OceanBaseVectorStore
from pyobvector import ObVecClient

client = ObVecClient()

client.perform_raw_text_sql(
    "ALTER SYSTEM ob_vector_memory_limit_percentage = 30"
)

# Initialize OceanBaseVectorStore
oceanbase = OceanBaseVectorStore(
    client=client,
    dim=1536,
    drop_old=True,
    normalize=True,
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_vector_stores_oceanbase-0.3.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_vector_stores_oceanbase-0.3.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_vector_stores_oceanbase-0.3.1.tar.gz
Algorithm Hash digest
SHA256 91b82e2dd76afee6190550df8272c2a7a71688f0c492682c0684f6f26807ba6a
MD5 5ace9c056ad01b702ca4d8694e5d8f31
BLAKE2b-256 7a121bda72e6ddd199268701e17cb248204f50ba84b3c75cb3d6f1fcb7630ff7

See more details on using hashes here.

File details

Details for the file llama_index_vector_stores_oceanbase-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_vector_stores_oceanbase-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f15328a8e577979cbb64c7e5ccfd8c4a0933ef18589110b6cf803be82557cd48
MD5 1952e5ba7601f8e623fb860bdfc527d8
BLAKE2b-256 fa381536943ccac009e5ba47f9da1d350b6de19123b0c1e1c98e8a7be22e2d0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page