Skip to main content

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-index
  • psycopg (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.

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

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

llama_index_vector_stores_azurepostgres-0.3.0-py2.py3-none-any.whl (22.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file llama_index_vector_stores_azurepostgres-0.3.0.tar.gz.

File metadata

  • Download URL: llama_index_vector_stores_azurepostgres-0.3.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_vector_stores_azurepostgres-0.3.0.tar.gz
Algorithm Hash digest
SHA256 39a371aa19968021b1316ef7582da76825df63db844271cc9db9a103d2690472
MD5 bf4232e50f411557d98526204710d7f8
BLAKE2b-256 6202e62d95ef6c40d65dafa647a2ecb70e67088d7872b5711ed2f9ca3000efb3

See more details on using hashes here.

File details

Details for the file llama_index_vector_stores_azurepostgres-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: llama_index_vector_stores_azurepostgres-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_vector_stores_azurepostgres-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dde2f4796731743bdc214d2a58af2a83caf1bcb0716e71f554a41697792d6d19
MD5 2d4eec5a59c8a21522793b199034bc28
BLAKE2b-256 38c667eec8bd6e69dc3068dc48ab02dca483d473c5c22b8209b9c05651334852

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page