Oracle AI Vector Search DocumentStore integration for Haystack
Project description
oracle-haystack
Haystack DocumentStore backed by Oracle AI Vector Search, available in Oracle Database 23ai and later.
Installation
pip install oracle-haystack
Requires Python 3.10+ and Oracle Database 23ai (or later). No Oracle Instant Client is needed for direct TCP connections (thin mode).
Usage
from haystack.utils import Secret
from haystack_integrations.document_stores.oracle import OracleConnectionConfig, OracleDocumentStore
from haystack_integrations.components.retrievers.oracle import OracleEmbeddingRetriever
# Configure the connection
config = OracleConnectionConfig(
user=Secret.from_env_var("ORACLE_USER"),
password=Secret.from_env_var("ORACLE_PASSWORD"),
dsn=Secret.from_env_var("ORACLE_DSN"),
)
# Create the document store
store = OracleDocumentStore(
connection_config=config,
table_name="my_documents",
embedding_dim=768,
distance_metric="COSINE",
create_table_if_not_exists=True,
)
# Write documents
from haystack.dataclasses import Document
store.write_documents([
Document(content="Oracle 23ai supports native vector search."),
])
# Retrieve by embedding
retriever = OracleEmbeddingRetriever(document_store=store, top_k=5)
results = retriever.run(query_embedding=[0.1] * 768)
print(results["documents"])
Connecting to Oracle Autonomous Database (ADB-S / wallet)
config = OracleConnectionConfig(
user=Secret.from_env_var("ORACLE_USER"),
password=Secret.from_env_var("ORACLE_PASSWORD"),
dsn=Secret.from_env_var("ORACLE_DSN"),
wallet_location="/path/to/wallet",
wallet_password=Secret.from_env_var("WALLET_PASSWORD"),
)
Optional HNSW index
Pass create_index=True when constructing the store to build an HNSW vector index, which dramatically speeds up approximate nearest-neighbour search on large collections:
store = OracleDocumentStore(
connection_config=config,
table_name="my_documents",
embedding_dim=768,
create_index=True,
hnsw_neighbors=32,
hnsw_ef_construction=200,
hnsw_accuracy=95,
)
Contributing
Refer to the general Contribution Guidelines.
Running tests
Unit tests
PYTHONPATH=src hatch run test:unit -vvv
Integration tests against a live Oracle instance
Set ORACLE_USER, ORACLE_PASSWORD, and ORACLE_DSN environment variables to point at your Oracle 23ai instance, then:
PYTHONPATH=src hatch run test:integration -vvv
Integration tests via Docker (local Oracle 23ai Free)
A docker-compose.yml is provided that runs gvenzl/oracle-free:23-slim (Oracle Database 23ai Free edition).
docker compose up -d --wait
--wait blocks until the Oracle healthcheck passes (the first boot takes 2–4 minutes while Oracle initialises its data files).
Run the full integration test suite:
PYTHONPATH=src hatch run test:integration -vvv
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oracle_haystack-0.1.0.tar.gz.
File metadata
- Download URL: oracle_haystack-0.1.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee1f829422e7251595b88e68f751d1b9dc750431931b2e288c3934d3c14d56cd
|
|
| MD5 |
dad80f75fefaee25472ee56a9c656f99
|
|
| BLAKE2b-256 |
16ba20bf3f46c7b96dd1252b8562ae7a3326da6bb5d41e88f18983d9c70f2ff5
|
Provenance
The following attestation bundles were made for oracle_haystack-0.1.0.tar.gz:
Publisher:
CI_pypi_release.yml on deepset-ai/haystack-core-integrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oracle_haystack-0.1.0.tar.gz -
Subject digest:
ee1f829422e7251595b88e68f751d1b9dc750431931b2e288c3934d3c14d56cd - Sigstore transparency entry: 1317221790
- Sigstore integration time:
-
Permalink:
deepset-ai/haystack-core-integrations@202ce2e10dfbc62a7d88bc30ba70d5b4aa5bb347 -
Branch / Tag:
refs/tags/integrations/oracle-v0.1.0 - Owner: https://github.com/deepset-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
CI_pypi_release.yml@202ce2e10dfbc62a7d88bc30ba70d5b4aa5bb347 -
Trigger Event:
push
-
Statement type:
File details
Details for the file oracle_haystack-0.1.0-py3-none-any.whl.
File metadata
- Download URL: oracle_haystack-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11a2f8151c4c4cdd4c81f628dbe483098c576af7f40f708dd202575db1155afe
|
|
| MD5 |
1b5b10ed97983e64c1844d7e29a72525
|
|
| BLAKE2b-256 |
01d5e69b959e4d7d6a2e8f57b9fa1276e334980518bbe717c02f4d7f18b518e6
|
Provenance
The following attestation bundles were made for oracle_haystack-0.1.0-py3-none-any.whl:
Publisher:
CI_pypi_release.yml on deepset-ai/haystack-core-integrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oracle_haystack-0.1.0-py3-none-any.whl -
Subject digest:
11a2f8151c4c4cdd4c81f628dbe483098c576af7f40f708dd202575db1155afe - Sigstore transparency entry: 1317221827
- Sigstore integration time:
-
Permalink:
deepset-ai/haystack-core-integrations@202ce2e10dfbc62a7d88bc30ba70d5b4aa5bb347 -
Branch / Tag:
refs/tags/integrations/oracle-v0.1.0 - Owner: https://github.com/deepset-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
CI_pypi_release.yml@202ce2e10dfbc62a7d88bc30ba70d5b4aa5bb347 -
Trigger Event:
push
-
Statement type: