Gen AI utility AWS bedrock model,RAG (Opensearch)
- Data Ingestion: Load data to an Opensearch Index
- Embedding and Model: AWS Bedrock Titan
- Vector Store and Endpoint: Opensearch
- LLM model : anthropic.claude-3-sonnet-20240229-v1:0
- Cloud : AWS Bedrock & AWS opensearch for Vector storage
- Evaluating ,Monitoring and metrics : Langsmith
- Data: PDF data
- LangChain & AWS Langchain is a framework for building applications powered by large language models (LLMs). It is designed to streamline the integration of LLMs with various components, such as external data sources, user-defined workflows, and tools like databases or APIs. LangChain helps developers build robust, scalable, and dynamic AI-driven applications.
- Microservice: FastAPI & Uvicorn
git clone https://github.com/benitomartin/aws-bedrock-opensearch-langchain.git
Create the virtual environment named main-env using Conda with Python version 3.10:
conda create -n main-env python=3.11
conda activate main-env
pip install -r requirements.txt
python rag_api_chat.py
http://0.0.0.0:8847/docs#/default/chat_application_chat_post
{ "query": "Can you describe the React approach?", "user_id": "string" }
`` { "response": "Based on the context provided, I can describe the ReAct (Reasoning and Acting) approach in the following way:\n\n1) ReAct is a method that allows large language models to synergize reasoning and acting for tasks that require multi-step reasoning and decision making in interactive environments.\n\n2) It prompts the language model with sparse thoughts or reasoning steps along with the observations and actions taken in an interactive environment. This allows the model to integrate its reasoning process with the actions and observations in a coherent stream of inputs.\n\n3) For example, in a question-answering task, ReAct would prompt the model with thoughts like "I need to search for X", followed by the search results, then "The observation says Y, so the answer is Z". This interleaves the reasoning process with the actions taken (searching) and observations received.\n\n4) ReAct was evaluated on multi-hop question-answering tasks like HotpotQA, fact-checking tasks, and interactive decision-making environments like ALFWorld (a text-based game) and WebShop (an online shopping website). It showed superior performance compared to baselines like just prompting actions or using chain-of-thought prompting.\n\n5) The key advantage of ReAct is that it allows the language model to perform interpretable multi-step reasoning integrated with actions taken in an interactive environment, leading to better performance on complex reasoning and decision-making tasks."
}
``
To install required packages, run the following command:
pip install opensearch-py transformers torch sentence-transformers
These packages form the backbone of the RAG system:
opensearch-py: The official Python client for OpenSearch
transformers: Hugging Face’s library for working with transformer models
torch: PyTorch library for deep learning operations
sentence-transformers: Used for creating embeddings
