Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge from dev #477

Merged
merged 11 commits into from
Dec 6, 2024
Merged

chore: merge from dev #477

merged 11 commits into from
Dec 6, 2024

Conversation

NingLu
Copy link
Collaborator

@NingLu NingLu commented Dec 6, 2024

Fixes #

🤖 AI-Generated PR Description (Powered by Amazon Bedrock)

Description

This pull request includes several changes to the codebase, primarily focused on updating the integration with the LangChain library and improving the functionality of various chains and tools used in the application. The changes also include updates to the user interface components and utility functions.

The modifications span multiple files, including updates to the RAG (Retrieval-Augmented Generation) tool, chat models, conversation summary chain, query rewrite chain, and tool-calling chains. Additionally, there are changes to the constant and utility functions used throughout the codebase.

These updates aim to enhance the overall performance, reliability, and user experience of the application by leveraging the latest features and improvements provided by the LangChain library.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

File Stats Summary

File number involved in this PR: 20, unfold to see the details:

The file changes summary is as follows:

Files
Changes
Change Summary
source/lambda/online/common_logic/common_utils/constant.py 2 added, 0 removed The code change adds two new constants, NOVA_PRO and NOVA_PRO, to the LLMModelType class, with one commented out.
source/lambda/online/common_logic/langchain_integration/chains/rag_chain.py 5 added, 0 removed The code adds a new class NovaProRAGLLMChain that inherits from Claude2RagLLMChain and sets the model_id attribute to LLMModelType.NOVA_PRO.
source/lambda/online/common_logic/langchain_integration/chains/conversation_summary_chain.py 4 added, 0 removed The code changes introduce two new classes, GLM4Chat9BConversationSummaryChain and NovaProConversationSummaryChain, which extend Claude2ConversationSummaryChain for different language models.
source/portal/src/utils/const.ts 1 added, 0 removed The code change adds a new model 'us.amazon.nova-pro-v1:0' to the LLM_BOT_COMMON_MODEL_LIST array, which likely contains a list of available language models.
source/lambda/online/common_logic/langchain_integration/chains/hyde_chain.py 4 added, 0 removed The code adds two new classes, Internlm2Chat20BHydeChain and NovaProHydeChain, which inherit from existing classes and define specific model IDs.
source/lambda/online/common_logic/langchain_integration/chains/tool_calling_chain_claude_xml.py 5 added, 0 removed The code adds two new classes, Claude35SonnetToolCallingChain and NovaProToolCallingChain, which inherit from Claude2ToolCallingChain and specify different model IDs.
source/lambda/online/common_logic/langchain_integration/chat_models/bedrock_models.py 11 added, 3 removed This code change adds environment variable support for AWS credentials in the create_model function, and defines two new classes CohereCommandRPlus and NovaPro that inherit from Claude2.
source/lambda/online/common_logic/common_utils/response_utils.py 5 added, 3 removed This code change removes the 'figure' extraction from the response dictionary, and instead extracts the first two elements of the 'ref_figures' list from the 'extra_response' dictionary, and assigns it to the 'ddb_additional_kwargs' dictionary under the 'figure' key.
source/lambda/online/common_logic/langchain_integration/chains/tool_calling_chain_api.py 4 added, 0 removed The code adds two new classes, CohereCommandRPlusToolCallingChain and NovaProToolCallingChain, which inherit from Claude2ToolCallingChain and set specific model IDs.
.viperlightignore 1 added, 0 removed This commit updates utility functions, adds a new file for prompt utilities, modifies tests for the product information search lambda function, and updates documentation files.
source/lambda/online/common_logic/langchain_integration/chat_models/init.py 3 added, 1 removed The code changes import the NovaPro model into the _import_bedrock_models function and add a mapping for LLMModelType.NOVA_PRO to _import_bedrock_models in the _load_module function.
source/portal/src/pages/chatbot/components/Message.tsx 9 added, 1 removed The code changes add a custom component for rendering images in Markdown with a maximum width of 150px and auto height, while also applying custom CSS classes for table elements.
source/lambda/online/common_logic/langchain_integration/tools/common_tools/rag.py 51 added, 7 removed This code change introduces several new features and modifications to the existing rag_tool function. It adds logging capabilities, a helper function to extract and process references from the LLM output, retrieves document and figure data, and integrates with a DynamoDB-based prompt template system for different task types and models.
source/model/etl/code/sm_predictor.py 12 added, 9 removed The code changes involve importing modules in a different order, adding some exception handling for invalid parameters, and adding a Flask route for handling POST requests to the '/invocations' endpoint for processing PDF files from an S3 bucket.
source/lambda/online/common_logic/langchain_integration/chains/query_rewrite_chain.py 6 added, 1 removed This code change introduces new classes for different language model types (Claude 3.5 Sonnet, Claude 3.5 Sonnet V2, Intern LM 2 Chat 20B, and Nova Pro) to handle query rewriting, inheriting from existing classes.
source/lambda/online/common_logic/langchain_integration/chains/chat_chain.py 4 added, 0 removed The code adds two new classes: ChatGPT4oChatChain for the GPT-4 model with online safety, and NovaProChatChain for the Nova Pro (Claude) model from Anthropic.
source/lambda/online/common_logic/langchain_integration/chains/init.py 13 added, 6 removed The code changes import new chains for the NovaProChatChain, NovaProConversationSummaryChain, NovaProRAGLLMChain, NovaProHydeChain, NovaProQueryRewriteChain, and NovaProToolCallingChain models.
source/lambda/online/common_logic/langchain_integration/tools/common_tools/init.py 28 added, 27 removed The code changes implement various tools for common tasks like getting weather, handling rhetorical questions, providing final responses, casual chat, retrieving private knowledge, and executing Python code within a REPL (Read-Eval-Print Loop) environment, with timeout handling for AWS Lambda compatibility.
source/lambda/online/common_logic/common_utils/prompt_utils.py 45 added, 12 removed This code change adds support for the new LLM model type NOVA_PRO across various prompt templates used for different tasks like RAG (Retrieval-Augmented Generation), conversation summarization, and tool calling API. It also updates the guidelines and instructions in some prompts for better clarity and formatting.
source/portal/src/pages/chatbot/components/Message.css 11 added, 0 removed The code changes add styles for displaying images within Markdown tables and regular Markdown content, ensuring they are responsive and centered.

@NingLu NingLu merged commit f45dff8 into aics Dec 6, 2024
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants