Skip to main content

Oracle VecDB Python SDK  ⚡️

PyPI Python Versions Status

🚀 About

Oracle VecDB Python SDK provides a Python-native interface for building vector search and AI applications with Oracle AI Database 23.26.3 and later. It supports both Autonomous AI Vector Database deployments and customer-managed Oracle AI Database instances exposed through ORDS 26.2.2 or later.

The SDK provides straightforward APIs for creating and managing vector tables and indexes, executing vector similarity searches, and invoking inference operations—allowing developers to integrate Oracle AI Database vector capabilities into Python applications with minimal setup and boilerplate.

✨ Highlights

  • 🔐 Typed client with simple auth + configuration
  • 📦 Manage vector tables, vector indexes, and metadata programmatically
  • 🧠 Run embeddings & inference flows via Oracle AI Database models
  • 🔄 Integrate vector search, filtering, and RAG-style pipelines quickly

📦 Installation

python -m pip install --upgrade oracle-vecdb

🚀 Quickstart

See the Oracle VecDB documentation for installation, pre-requisites, and the complete API reference.

This quickstart connects to Oracle VecDB, creates a table with integrated embeddings, loads sample records, and runs a filtered similarity search. Most SDK methods return typed response models. Import stable SDK response types from oracle_vecdb.data_types, and use .model_dump() or .to_dict() when you need a plain dictionary representation.

1. Configure the client

VecDB rest_url has this form but it might change based on the setup:

https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/

Note: Ensure TLS is enabled and that the endpoint is reachable from your environment.

from oracle_vecdb import OracleVecDB, Configuration

config = Configuration(
    rest_url="https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/",
    # choose one auth method
    access_token="<bearer-token>",
    # or username="<user>", password="<pass>",
)

vecdb = OracleVecDB(config)

For all constructor parameters and object attributes, see the Oracle VecDB documentation.

2. Create an integrated embedding vector table

Create a table that generates embeddings from text stored in metadata. The configured model must already be available in Oracle AI Database.

vecdb.create_vector_table(
    name="demo",
    table_params={"auto_generate_id": True},
    embed_params={
        "model": "all_MiniLM_L12_v2",  # must be preloaded via Vector Database Console or load_model()
        "embed_metadata_jsonpath": "content",  # JSON field in metadata to extract text from for embedding
    },
)

3. Load integrated embedding records

When an integrated embedding vector table is configured, provide text in the metadata field selected by embed_metadata_jsonpath. The database generates the vector during the upsert.

vecdb.upsert_vectors(
    table_name="demo",
    vectors=[
        {
            "metadata": {
                "title": "Comedy movie review",
                "content": "A lighthearted comedy with fast-paced jokes.",  # text to embed
                "genre": "comedy",
            }
        },
        {
            "metadata": {
                "title": "Drama movie review",
                "content": "An emotional family drama with strong performances.",
                "genre": "drama",
            }
        },
    ],
)

4. Run a text query with filtering

A text query uses the table's configured embedding model to generate the query vector.

results = vecdb.query(
    table_name="demo",
    query_by={"text": "family drama"},  # uses integrated embeddings for the query text
    filters={"genre": {"$eq": "drama"}},
    top_k=1,
)

for index in range(len(results)):
    item = results[index]
    row = item if isinstance(item, dict) else item.model_dump()
    print(row["id"], row["distance"], row["metadata"])

📥 Ingestion Options

Bring your own vectors

For precomputed embeddings, omit embed_params when creating the vector table and provide dense_vector values in each record.

vecdb.create_vector_table(name="demo_byov")
vecdb.upsert_vectors(
    table_name="demo_byov",
    vectors=[
        {"id": "1", "dense_vector": [0.1, 0.1], "metadata": {"genre": "comedy"}},
        {"id": "2", "dense_vector": [0.2, 0.2], "metadata": {"genre": "drama"}},
    ],
)
results = vecdb.query(
    table_name="demo_byov",
    query_by={"vector": [0.15, 0.1]},
    filters={"genre": {"$eq": "drama"}},
    top_k=1,
)

for index in range(len(results)):
    item = results[index]
    row = item if isinstance(item, dict) else item.model_dump()
    print(row["metadata"]["genre"])

🔧 Indexing and tuning

Create indexes after loading data

Create the table first and build its index explicitly when the data-loading workflow is complete.

vecdb.create_vector_table(
    name="demo_manual",
    index_params={"vector_index_params": {"auto_index": False}},
)

vecdb.create_index(table_name="demo_manual")

Create an HNSW index

Use INMEMORY GRAPH organization for an HNSW (Hierarchical Navigable Small World) vector index.

vecdb.create_vector_table(
    name="demo_hnsw",
    index_params={
        "vector_index_params": {
            "auto_index": True,
            "organization": "INMEMORY GRAPH",  # HNSW-style index organization
            "distance_metric": "COSINE",
            "advanced_params": {
                "neighbors": 32,  # higher = better recall, more memory
                "efConstruction": 200,  # higher = better recall, slower index build
            },
        },
    },
)

Query-time HNSW tuning

Use advanced_options to adjust HNSW runtime search behavior. efsearch is HNSW-only; use it to control the candidate pool size and balance recall against query latency without rebuilding the index.

results = vecdb.query(
    table_name="demo",
    query_by={"text": "family drama"},
    filters={"genre": {"$eq": "drama"}},
    top_k=1,
    advanced_options={
        "idx_parameters": {
            "efsearch": 64,  # number of candidates explored (higher = better recall, higher latency)
        }
    },
)

Examples

  • Samples can be found in the /examples directory.
  • Sample notebooks – Guided notebooks for setup, table/index workflows, vector search, and inference via the SDK.
  • Sample applications – Oracle AI Developer Hub apps showcasing ingestion, embeddings, search, filtering, and FastAPI + React/Vite integration using this SDK.

Dependencies and Interoperability

  • Python 3.10 or later.
  • Oracle AI Database 23.26.3 or later with ORDS 26.2.2+ enabled.
  • An Oracle ORDS VecDB endpoint configured with either bearer-token or HTTP Basic authentication.

The SDK can be used in applications, notebooks, retrieval-augmented generation (RAG) pipelines, and other Python services that need Oracle vector search. For setup instructions and guidance on getting started with the VecDB APIs, see the Oracle VecDB documentation

📚 Documentation and Resources

Help

Questions can be asked in GitHub Discussions.

Problem reports can be raised in GitHub Issues.

🤝 Contributing

This project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide

🔐 Security

Please consult the security guide for our responsible security vulnerability disclosure process

📄 License

See LICENSE.txt, THIRD_PARTY_LICENSE.txt, and NOTICE.txt.

Download files

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

Source Distribution

oracle_vecdb-1.0.1.tar.gz (102.2 kB view details)

Uploaded Source

Built Distribution

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

oracle_vecdb-1.0.1-py3-none-any.whl (201.9 kB view details)

Uploaded Python 3

File details

Details for the file oracle_vecdb-1.0.1.tar.gz.

File metadata

  • Download URL: oracle_vecdb-1.0.1.tar.gz
  • Upload date:
  • Size: 102.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.19

File hashes

Hashes for oracle_vecdb-1.0.1.tar.gz
Algorithm Hash digest
SHA256 26d44855e6e457de81bab3366559c5eaa2cc2b0bd2ec1f9a7ccb7cb4cd2158ae
MD5 6690da03ca0e863fef20366a8744059a
BLAKE2b-256 1968fb860ec8c5396b940c26c265c643976d0ce9408c6e19aae31200455dd03d

See more details on using hashes here.

File details

Details for the file oracle_vecdb-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: oracle_vecdb-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 201.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.19

File hashes

Hashes for oracle_vecdb-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dcedffe1aec8667702c7c6a3453a72b062205c3a1933017d9ce9e5d261b54bfc
MD5 b98afa2e29c2a8a0a8bdeff22cf9fd03
BLAKE2b-256 2bd7c9442ee2687eecee454d3413f17080afcf55eeeda1ed069593f51a299ad6

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.2

2 files

This release

1.0.1 This release

2 files

1.0.0

2 files

Supported by

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