feat: Implement document-aware chat API#223
Open
SaravanakumarR2018 wants to merge 1 commit into
Open
Conversation
Introduces document-aware responses into the Chat API by integrating
retrieval augmented generation (RAG).
Key changes:
- Modified `LLMService.get_response` to:
1. Rewrite your query using the LLM based on conversation
history to make it suitable for vector search.
2. Search for relevant document chunks with the rewritten query.
3. Inject the search results (as-is) and conversation history
into a new prompt for the LLM.
4. Instruct the LLM to use the provided documents if relevant,
or answer from general knowledge (and state so if documents
were not helpful).
- Ensured that only your original query and the final assistant
response are saved to the database, excluding intermediate data
like rewritten queries or search results.
- Added unit tests for `LLMService.get_response` in
`test/UnitTests/chat_service/test_llm_service.py` covering
various RAG scenarios. (Note: I wrote tests but didn't execute them
due to temporary environment limitations regarding disk space
for heavy dependencies like torch/sentence-transformers).
This enhancement allows the chat service to provide more contextual
and accurate answers by leveraging a document knowledge base.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Introduces document-aware responses into the Chat API by integrating retrieval augmented generation (RAG).
Key changes:
LLMService.get_responseto:LLMService.get_responseintest/UnitTests/chat_service/test_llm_service.pycovering various RAG scenarios. (Note: I wrote tests but didn't execute them due to temporary environment limitations regarding disk space for heavy dependencies like torch/sentence-transformers).This enhancement allows the chat service to provide more contextual and accurate answers by leveraging a document knowledge base.