Skip to content

mgiang2015/rag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

WEB-RAG Project

With more widespread use of Large Language Models (LLMs), the risks of hallucination becomes significant. One approach to minimise hallucination is using Retrieval-Augmented Generation technique, where the LLM knowledge is bounded in a given context. Context comes from ingesting material (websites, documents, text, ...), creating embeddings and storing them in a vector database.

Demo

Demo video on Youtube

Tech Stack

Backend: Python

Frameworks: LangChain, FastAPI

Vectorstore: Pinecone

Environment Set-up

  1. Clone the repository and navigate to my-app directory
cd my-app/
  1. Set up your python virtual environment and install dependencies
pip install -r requirements.txt
  1. Set up your Pinecone account, follow their documentation to set up a project and an index

  2. Set up your OpenAI API account

  3. (Optional) Set up your LangSmith account if you'd like to trace LangChain's output at every step.

  4. Set up your environment variables

# Compulsory
PINECONE_API_KEY=
PINECONE_ENVIRONMENT=
PINECONE_INDEX=
OPENAI_API_KEY=

# Optional
LANGCHAIN_TRACING_V2=
LANGCHAIN_ENDPOINT=
LANGCHAIN_API_KEY=
LANGCHAIN_PROJECT=
  1. Run the application at port 8080 (change port if needed)
uvicorn app.server:app --host 0.0.0.0 --port 8080
  1. Navigate to /docs for documentation of API endpoints offered.

  2. Main end-points you will interact with are:

  • POST /rag-pinecone/website: Ingest data from a given website. Takes a query parameter url. Example:
http://localhost:8080/rag-pinecone/website?url=https://lilianweng.github.io/posts/2023-06-23-agent
  • POST /rag-pinecone/invoke: Question and answer with agent. Takes in a JSON body.
{
    "input": "What is task decomposition?"
}
  • POST /rag-pinecone/stream: Question and answer with agent, but answers are streamed. Takes in a JSON body
{
    "input": "What is task decomposition?"
}
  1. Feel free to modify packages/rag-pinecone/rag_pinecone/chain.py to experiment with LangChain. With every modification, run the following to update the module:
pip install packages/rag-pinecone

Contacts

Email: [email protected]

LinkedIn: https://www.linkedin.com/in/leminhgiang/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published