Skip to content

sammydowds/terminal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Background Image

Summary

Terminal is a project that helps get a simple RAG (Retrieval-Augmented Generation) up and running based on a user specified set of PDFs.

Getting started

Database

Start the database:

cd terminal/terminal/docker && docker compose up -d

Note: this project utilizes the pgvector/pgvector image referenced here.

Initialize the table:

psql -h localhost -p 5432 -U user -d terminal -f ../db/init.sql

Ingest Documents

Ensure you have a local .env containing the following:

OPENAI_API_KEY=<insert your openai key>
DATABASE_URL=<insert local database URL>

Note: OpenAI is used to generate the embeddings.

Run the ingestion over a specified folder containing PDF's you would like to use as the target for queries. Ingestion consists of looping through files, chunking them (with overlap), and saving the embedding to a postgres db.

ingestor = Ingestor()

ingestor.ingest('documents')

Processing (retrieval and response)

processor = Processor()

processor.retrieve_content(query) # embed, search in vector DB 
processor.stream_completion(query) 
# OR
processor.completion(query)

About

A simple RAG framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages