Pgai: Giving PostgreSQL Developers AI Engineering Superpowers
Introduction to PgAI
Pgai is an open-source extension that brings embedding and generation models closer to the database, making PostgreSQL an even better database for AI applications.
Pgai is incredibly exciting for building AI applications with PostgreSQL. Having embedding functions directly within the database is a huge bonus. Previously, updating our saved embeddings was a tedious task, but now, with everything integrated, it promises to be much simpler and more efficient. This will save us a significant amount of time and effort.
PgAI’s Goal: Accessibility and Efficiency
The goal of pgai is to make working with AI easier and more accessible to developers. Because data is the foundation of most AI applications, pgai makes it easier to leverage your data in AI workflows. In particular, pgai supports:
Core Components of PgAI on Timescale Cloud
PgAI on Timescale Cloud consists of three extensions:
- pgvector: Provides the vector data type and HNSW search index.
- pgvectorscale: Powers embedding search with the StreamingDiskANN index, making vector queries performant.
- pgai: Allows seamless integration of AI embedding and generation models directly from the database.
All three extensions are installed by default in your Timescale Cloud instance.
Simplifying Embedding Workflows
Managing embedding workflows for AI systems like RAG, search and AI agents can be a hassle: juggling multiple tools, setting up complex pipelines, and spending hours syncing data, especially if you aren’t an ML or AI expert. But it doesn’t have to be that way.
PgAI Vectorizer: Streamlined AI Development
With PgAI Vectorizer, you can:
- Automate vector embedding creation.
- Keep embeddings synced as data changes.
- Experiment with AI models effortlessly.
This eliminates the need for extra tools or complex setups, letting PostgreSQL handle the heavy lifting.
Efficiency with Simple SQL Commands
pgai Vectorizer streamlines our AI workflow, from embedding creation to real-time syncing, making AI development faster and simpler all in PostgreSQL.
A single line of code sets up a vectorizer to embed table data :
Pgai is a PostgreSQL extension that brings more AI workflows to PostgreSQL, like embedding creation and model completion.
Open-Source and Developer-Friendly
Licensed under the Open Source PostgreSQL License, pgai further enriches the PostgreSQL AI ecosystem, making it easier for developers to build search and retrieval-augmented generation (RAG) applications.
Empowering Developers with PgAI
The pgai extension is designed to provide application developers familiar with PostgreSQL with enhanced tools to streamline their workflows and overcome challenges as they progress from concept to proof of concept (PoC) and ultimately to creating production-ready AI applications. In essence, it aims to transform more PostgreSQL developers into AI engineers.
Working with embeddings generated from your data:
- Automatically create and sync vector embeddings for your data (learn more)
- Search your data using vector and semantic search (learn more)
- Implement Retrieval Augmented Generation inside a single SQL statement (learn more)
- Perform high-performance, cost-efficient ANN search on large vector workloads with pgvectorscale, which complements pgvector.
- Retrieve LLM chat completions from models like Claude Sonnet 3.5, OpenAI GPT4o, Cohere Command, and Llama 3 (via Ollama). (learn more)
- Reason over your data and facilitate use cases like classification, summarization, and data enrichment on your existing relational data in PostgreSQL (see an example).
Features of pgai
The main features in pgai are:
Working with embeddings generated from your data:
The pgai Vectorizer automates embedding creation and synchronization for text data, leveraging pgvector and pgvectorscale extensions for efficient storage and fast vector searches.
pgai exposes a set of functions to directly interact with the LLM models through SQL, enabling you to do semantic search directly in your database.
Similar to semantic search, pgai LLM functions enable you to implement RAG directly in your database.
At Techrover™ Solutions, tools such as pgai give us the opportunity to empower businesses with cutting-edge AI workflows. Our scalable solutions ensure clients stay ahead in the ever-evolving tech landscape. We are driven by innovation and a passion for creating impactful technology. Let’s shape the future together with smarter, more agile solutions that inspire growth and success!