Back to Chatgpt Retrieval Plugin

AnalyticDB

docs/providers/analyticdb/setup.md

latest3.5 KB
Original Source

AnalyticDB

AnalyticDB is a distributed cloud-native vector database designed for storing documents and vector embeddings. It is a high-performance vector database that is fully compatible with PostgreSQL syntax, making it easy to use. Managed by Alibaba Cloud, AnalyticDB offers a powerful vector compute engine, processing billions of data vectors and providing a wide range of features, including indexing algorithms, structured and unstructured data capabilities, real-time updates, distance metrics, scalar filtering, and time travel searches. Additionally, it offers full OLAP database functionality and an SLA commitment for production use.

Install Requirements

Run the following command to install the required packages, including the psycopg2cffi package:

poetry install --extras "postgresql"

If you encounter the Error: pg_config executable not found. issue, you need to install the PostgreSQL development package on your system. Follow the instructions for your specific Linux distribution:

  1. Debian-based systems (e.g., Ubuntu):
bash
sudo apt-get update
sudo apt-get install libpq-dev
  1. RHEL-based systems (e.g., CentOS, Fedora):
bash
sudo yum install postgresql-devel
  1. Arch-based systems (e.g., Manjaro, Arch Linux):
bash
sudo pacman -S postgresql-libs
  1. macOS:
bash
brew install postgresql

After installing the required package, try to install psycopg2cffi again. If the pg_config executable is still not found, add its location to your system's PATH variable. You can typically find the pg_config executable in the bin directory of your PostgreSQL installation, for example /usr/pgsql-13/bin/pg_config. To add it to your PATH variable, use the following command (replace the path with the correct one for your system):

bash
export PATH=$PATH:/usr/pgsql-13/bin

Now, try installing psycopg2cffi again using Poetry.

Environment Variables:

NameRequiredDescriptionDefault
DATASTOREYesDatastore name, set to analyticdb
BEARER_TOKENYesSecret token
OPENAI_API_KEYYesOpenAI API key
PG_HOSTYesAnalyticDB instance URLlocalhost
PG_USERYesDatabase useruser
PG_PASSWORDYesDatabase passwordpassword
PG_PORTOptionalPort for AnalyticDB communication5432
PG_DATABASEOptionalDatabase namepostgres
PG_COLLECTIONOptionalAnalyticDB relation namedocument_chunks

AnalyticDB Cloud

For a hosted AnalyticDB Cloud version, provide the AnalyticDB instance URL:

Example:

bash
PG_HOST="https://YOUR-CLUSTER-URL.gpdb.rds.aliyuncs.com"
PG_USER="YOUR-USER-NAME"
PG_PASSWORD="YOUR-PASSWORD"

The other parameters are optional and can be changed if needed.

Running AnalyticDB Integration Tests

A suite of integration tests verifies the AnalyticDB integration. Launch the test suite with this command:

bash
pytest ./tests/datastore/providers/analyticdb/test_analyticdb_datastore.py