Cohere.embed-English-v3 - Text
Anthropic Claude 2.1
In this project, I built a CHATBOT like application with AWS Amazon Bedrock, docker, python, Langchain, and Streamlit. I used the Retrieval-Augmented generation concept to provide context to the Large Language model along with user query to generate response from the Knowledgebase.
In this project, I will demonstrate the following:
- Architecture of the applications
- Build 2 applications (ADMIN and USER) and create DOCKER images
- Build Admin Web application where AdminUser can upload the pdf.
- The PDF text is split into chunks
- Using the Amazon Titan Embedding Model, create the vector representation of the chunks
- Using FAISS, save the vector index locally
- Upload the index to Amazon S3 bucket (You can use other vector stores like OpenSearch, Pinecone, PgVector etc., but for this demo, I chose cost effective S3)
Build Docker Image:
docker build -t pdf-reader-admin .
Run ADMIN application:
docker run -e BUCKET_NAME=<YOUR S3 BUCKET NAME> -v ~/.aws:/root/.aws -p 8083:8083 -it pdf-reader-admin
- Build User Web application where users can query / chat with the pdf.
- At the application start, download the index files from S3 to build local FAISS index (vector store)
- Langchain's RetrievalQA, does the following:
- Convert the User's query to vector embedding using Amazon Titan Embedding Model (Make sure to use the same model that was used for creating the chunk's embedding on the Admin side)
- Do similarity search to the FAISS index and retrieve 5 relevant documents pertaining to the user query to build the context
- Using Prompt template, provide the question and context to the Large Language Model. We are using Claude model from Anthropic.
- Display the LLM's response to the user.
Build Docker Image:
docker build -t pdf-reader-client .
Run ADMIN application:
docker run -e BUCKET_NAME=<YOUR S3 BUCKET NAME> -v ~/.aws:/root/.aws -p 8080:8080 -it pdf-reader-client