Supercharge the RAG API with an option for advanced Database backends #9612
Dual-0
started this conversation in
Feature Requests & Suggestions
Replies: 1 comment
-
Thanks for mentioning CloudNativePG (I am a maintainer and co-founder). My suggestion is to use the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everybody,
first of all, thank you for creating such an application. I'm currently migrating my LibreChat stack from a podman environment to Kubernetes, managed declaratively with FluxCD (GitOps). The last two days I'm focusing on optimizing the RAG API deployment.
My current goal is to move beyond the default
pgvector
setup to a more resilient and powerful database architecture. On my way I hit some limitations in thelibrechat-rag-api
Helm chart. So I want to share my setup, the advantages, and a proposal for the chart to unlock a new level of performance and manageability for interested users.A Modern, High-Performance Vector Database
Based on what I've learned so far about vector databases, the default Bitnami
pgvector
chart is great for getting started, but there could be something better and more robust for advanced environment. Inspired by this blog post I had to look into deploying the VectorChord extension, which is meant to be a powerful alternative topgvector
with a massive leap forward in cost-efficiency and performance for large-scale vector searches.The beauty of this is that VectorChord isn't just for Kubernetes. It's a PostgreSQL extension. Anyone can run a high-performance VectorChord database using Docker or Podman on a VM, like I do before. The core requirement is that the LibreChat RAG API needs to be able to connect to it... more on that later.
Example: CloudNativePG with VectorChord on Kubernetes
In my Kubernetes environment, I use the CloudNativePG (CNPG) Operator to manage my VectorChord database. This provides true, declarative management of PostgreSQL clusters with high availability and automated failover.
This example defines the entire cluster, the specialized VectorChord image, the user, and the extensions in a single file:
This is the kind of powerful and modern infrastructure we should be able to easily connect LibreChat to. The most compelling reason for this enhancement is that VectorChord is designed as a seamless, drop-in replacement for
pgvector
. From the application's perspective, the migration is essentially transparent. According to the VectorChord README.md, it is "fully compatible withpgvector
data types and syntax." This means that LibreChat's RAG API, which already works withpgvector
, requires zero code changes to benefit from VectorChord.Unfortunately, integrating this database with the current Helm-Chart was a bit difficult due to a hardcoded
DB_HOST
in the ConfigMap. This effectively locks users into the in-chart PostgreSQL and prevents connections to any existing or external database.The only solution I was able to use is a
postRenderer
patch to forcefully inject the correctDB_HOST
at runtime.To unlock the full potential of the RAG API for everyone, I propose a simple enhancement to allow
DB_HOST
to be configured via values.yamlThis small change would eliminate the need for complex patches and allow anyone to connect the RAG API to a high-performance database—whether it's on Kubernetes, Docker or Podman.
Feedback is always welcome. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions