feat: support showing image in chat box #481
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #
🤖 AI-Generated PR Description (Powered by Amazon Bedrock)
Description
This pull request includes updates to the prompt and response handling utilities, as well as improvements to the Retrieval Augmented Generation (RAG) tool integration in the LangChain framework. Additionally, minor changes have been made to the ChatBot component in the portal application.
The changes in
prompt_utils.py
andresponse_utils.py
aim to enhance the handling of user prompts and the formatting of responses, respectively. These improvements will provide a better user experience and more accurate results.The modifications to
tools/__init__.py
andrag.py
focus on optimizing the RAG tool integration within LangChain. This will enable more efficient retrieval and generation of relevant information, leading to improved response quality.Finally, the updates to
ChatBot.tsx
in the portal application are related to the user interface and may include bug fixes or minor enhancements to the chatbot experience.No additional dependencies are required for these changes.
Type of change
File Stats Summary
File number involved in this PR: 5, unfold to see the details:
The file changes summary is as follows:
filter_response
that filters out reference tags (<reference>
and</reference>
) from the LLM response, extracts the reference document numbers, and stores them along with the corresponding reference documents and figures in the state dictionary. It also removes duplicate figures from the list of reference figures.figure
array in theddb_additional_kwargs
object and appending image URLs to thecurrentAIMessage
state.