rds_ai
rds_ai · Alibaba Cloud RDS extension for calling LLMs, generating embeddings, semantic retrieval, and end-to-end RAG from SQL
Overview
PostgreSQL · 14, 15, 16, 17, 18
Usage
Sources:
rds_ai is an Alibaba Cloud extension for invoking large-language and embedding models from SQL on ApsaraDB RDS for PostgreSQL. It provides rds_ai.prompt, rds_ai.embed, rds_ai.retrieve, and rds_ai.rag for generation, vectorization, similarity retrieval, and retrieval-augmented generation, and can call configured HTTP-compatible custom models.
Install, Configure, and Prompt
A privileged RDS account can install the provider plugin. CASCADE also installs its pgvector and pgsql-http dependencies.
Model configuration is stored in rds_ai.model_list. Default provider models include Qwen prompt models and text-embedding-v3; rds_ai.add_model can register another HTTP-compatible endpoint.
Caveats
- This is an Alibaba Cloud provider extension, not a portable open-source package. Availability and the reported
1.0or1.0.0version depend on RDS PostgreSQL major/minor engine version and edition. - The provider requires a supported RDS engine, a privileged database account, and an active Model Studio API key. External model access also requires outbound VPC networking, commonly through NAT.
- Prompts, retrieved context, and embedding inputs are sent through HTTP to configured model endpoints. Apply data-classification, residency, logging, and egress controls before sending database content.
- API tokens and endpoint templates live in
rds_ai.model_listand are set through SQL. Restrict table and function privileges, avoid literal secrets in query logs, and rotate exposed credentials. - Preloading is not required for ordinary calls, but Alibaba Cloud documents adding
rds_aitoshared_preload_librariesbefore changingrds_ai.default_prompt_model. That change requires the managed-instance parameter workflow. - Dense and sparse embedding dimensions, default models, and supported minor versions can change with the service. Size vector columns from the live provider documentation rather than assuming catalog defaults.