Here are the key points from the notebook:
Chatbot (Basic - without context): This demonstrates a basic chatbot using the CoversationChain from LangChain, with ConversationBufferMemory for storing the messages. It shows how to start a conversation and remember previous interactions.
Chatbot using prompt template (Langchain): This shows how to use prompt templates from LangChain to define the chatbot’s responses. It includes examples of using ChatPromptTemplate and MessagesPlaceholder to incorporate the chat history.
Chatbot with personas: This section discusses how to create chatbots with defined roles, such as a Career Coach and Human interactions.
Chatbot with context: This is the main focus of the notebook. It demonstrates how to build a contextual-aware chatbot using the LangChain framework. Key elements include:
Langchain framework: LangChain provides memory components and easy ways to incorporate them into chatbot chains, making it easier to build powerful chatbots that remember previous interactions.
Architecture: The notebook includes a diagram showing the architecture of a context-aware chatbot, including the embeddings generation, user request orchestration, and invoking the results.
Setup: The notebook includes the necessary setup steps, such as installing dependencies and configuring the Bedrock boto3 client.
Prompt templates and history management: The notebook demonstrates the use of ChatPromptTemplate and MessagesPlaceholder to incorporate chat history into the prompts. It also shows how to use RunnableWithMessageHistory to automatically handle chat history.
Retrieval QA and Conversational Retrieval Chain: The notebook includes examples of using the RetrievalQA and ConversationalRetrievalChain from LangChain to incorporate document retrieval into the chatbot.
Agents and LangGraph: The notebook concludes by demonstrating the use of agents and LangGraph to create a more complex conversational interface with multiple tools and decision-making capabilities.
Overall, this notebook provides a comprehensive overview of building contextual-aware chatbots using the LangChain framework, with a focus on leveraging Amazon Bedrock for the language model and incorporating various chatbot patterns and architectures.