AI framework integrations for Azure Database for PostgreSQL
Project description
llama-index-vector-stores-azurepostgresql
Azure PostgreSQL Vector Store integration for LlamaIndex.
This package provides an integration for using Azure Database for PostgreSQL as a vector store backend with LlamaIndex, supporting advanced vector search capabilities (including pgvector, DiskANN, and hybrid search).
Features
- Store and query vector embeddings in Azure PostgreSQL
- Support for pgvector and DiskANN extensions
- Metadata filtering
- Seamless integration with LlamaIndex's core abstractions
Installation
You can install the package and its dependencies using uv, pip, or poetry:
uv pip install .
# or
pip install .
# or
poetry install
Dependencies:
llama-indexpsycopg(PostgreSQL driver)azure-identity(for Azure authentication)
Usage Example
import sys
sys.path.insert(0, "/path/to/llama-index-vector-stores-azurepostgresql")
from llama_index.vector_stores.azurepostgresql.base import AzurePGVectorStore
from llama_index.core import (
SimpleDirectoryReader,
StorageContext,
VectorStoreIndex,
)
from llama_index.llms.azure_openai import AzureOpenAI
from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding
# Set up your Azure OpenAI and PostgreSQL connection details
llm = AzureOpenAI(...)
embed_model = AzureOpenAIEmbedding(...)
vector_store = AzurePGVectorStore.from_params(
database="postgres",
host="<your-host>.postgres.database.azure.com",
port=5432,
table_name="my_table",
embed_dim=1536,
pg_diskann_kwargs={
"pg_diskann_operator_class": "vector_cosine_ops",
"pg_diskann_max_neighbors": 32,
"pg_diskann_l_value_ib": 100,
"pg_diskann_l_value_is": 100,
"pg_diskann_iterative_search": True,
},
)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
documents = SimpleDirectoryReader("./data").load_data()
index = VectorStoreIndex.from_documents(
documents, storage_context=storage_context
)
query_engine = index.as_query_engine()
response = query_engine.query("Your query here")
print(response)
Development
- To run tests:
make test
- To build the package:
uv build
License
This project is licensed under the terms of the Apache 2.0 license.
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 llama_index_vector_stores_azurepostgres-0.1.0.tar.gz.
File metadata
- Download URL: llama_index_vector_stores_azurepostgres-0.1.0.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17738d410d14dfc5d641cccaa594329174515cbe45b6c28fa228733e9740afd2
|
|
| MD5 |
09105a696eb3101fd3e7ea96466ff390
|
|
| BLAKE2b-256 |
23d2d08fdbb5bc627cd7cb16253bf08a3ad1212c8f463587a582540db670a235
|
File details
Details for the file llama_index_vector_stores_azurepostgres-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: llama_index_vector_stores_azurepostgres-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18dd7c158f6405d57f6b0d510b74dcfa29db56ad7ee81f011cd197f86c61abaa
|
|
| MD5 |
418c5121244b413dc3fbfb78f618e9af
|
|
| BLAKE2b-256 |
05ad141129cc0e35cb97935a58f6d0275fc6b505b7b2b51473d79d70b8f5e92f
|