#156 — Add external table/column to RAG

Repo: Twill-AI/twill-llm-engine State: closed | Status: done Assignee: meliascosta

Created: 2024-10-10 · Updated: 2025-02-04

Description

We want to be able to enhance LLM responses with information retrieved from a vector database. For this we are going to use pg_vector inside our postgres instance on supabase. The original class we had written for this used langchain community implementation of the PGVectorStore which seems a bit bloated. The first part of this task includes scoping the current state of our implemented class and the current status of the PGVectorStore development in Langchain.

AC:

  • Current state of code base and Langchain’s Vector Store implementation have been evaluated (results should be on this ticket). Decisions should be made as to where the main class to interact with the database should live (possibly python-shared). Both global and per tenant use cases should be considered. Only global case for now
  • #228
  • Facade can instantiate an object to interact with the vector store and exposes an API to search and store vector DB
  • Tests have been written on all relevant repos: facade, twill-llm-engine, shared

Considerations about langchains PgVector vector store

See https://python.langchain.com/docs/integrations/vectorstores/pgvector/

Cons

  • It doesn’t allow for migrations
  • It uses psychopg3
  • It uses sqlalchemy
  • We would need langchain_postgres as facade dep but twill_llm_engine depends on langchain and this create a double dependency on langchain which is not ideal.

Pros

  • It integrates easily into langchain’s ecosystem.

Conside

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets