-
Notifications
You must be signed in to change notification settings - Fork 19
Backend citation support #116
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
56367fe
Enhance chat functionality with citation and conversation reference h…
ArindamRoy23 adb8d91
Refactor chat_utils.py and chat.py for improved citation handling and…
ArindamRoy23 91c2757
Orphan segment IDs fixed
ArindamRoy23 a577f1f
Orphan segment IDs fix for citation
ArindamRoy23 9b01904
Enhance logging and error handling in chat_utils and audio ETL pipeline
ArindamRoy23 ed70531
Refactor citation handling and conversation reference structure in ch…
ussaama 0144463
Enhance conversation reference and citation handling in chat_utils an…
ArindamRoy23 e14f59e
Fix table name in audio ETL pipeline mapping
ArindamRoy23 3bbc2cd
Update lightrag-dembrane dependency to version 1.2.7.4 and enhance lo…
ArindamRoy23 d058290
Update lightrag-dembrane dependency to version 1.2.7.6 in pyproject.t…
ArindamRoy23 44e0951
Add LiteLLM configuration documentation and refactor database management
ArindamRoy23 d863b73
Refactor database.py to remove unused imports
ArindamRoy23 2dd808f
Refactor lightrag_utils.py for improved functionality and clarity
ArindamRoy23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # LiteLLM Configuration Documentation | ||
|
|
||
| This document outlines all LiteLLM-related configurations and their explanations used in the system. | ||
|
|
||
| ## Main LLM Model | ||
| **LIGHTRAG_LITELLM_MODEL**: Used by lightrag to perform Named Entity Recognition (NER) and create the knowledge graph | ||
| - Required Configurations: | ||
| - `LIGHTRAG_LITELLM_MODEL`: Model identifier (e.g., azure/gpt-4o-mini) | ||
| - `LIGHTRAG_LITELLM_API_KEY`: API key for authentication | ||
| - `LIGHTRAG_LITELLM_API_VERSION`: API version | ||
| - `LIGHTRAG_LITELLM_API_BASE`: Base URL for the API | ||
|
|
||
| ## Audio Transcription Model | ||
| **LIGHTRAG_LITELLM_AUDIOMODEL_MODEL**: Used by audio-lightrag to convert input to transcript and generate contextual transcript | ||
| - Required Configurations: | ||
| - `LIGHTRAG_LITELLM_AUDIOMODEL_MODEL`: Model identifier (e.g., azure/whisper-large-v3) | ||
| - `LIGHTRAG_LITELLM_AUDIOMODEL_API_BASE`: Base URL for the audio model API | ||
| - `LIGHTRAG_LITELLM_AUDIOMODEL_API_KEY`: API key for authentication | ||
| - `LIGHTRAG_LITELLM_AUDIOMODEL_API_VERSION`: API version | ||
|
|
||
| ## Text Structure Model | ||
| **LIGHTRAG_LITELLM_TEXTSTRUCTUREMODEL_MODEL**: Used to structure the output of the audio model into desired format | ||
| - Required Configurations: | ||
| - `LIGHTRAG_LITELLM_TEXTSTRUCTUREMODEL_MODEL`: Model identifier (e.g., azure/gpt-4o-mini) | ||
| - `LIGHTRAG_LITELLM_TEXTSTRUCTUREMODEL_API_BASE`: Base URL for the text structure model API | ||
| - `LIGHTRAG_LITELLM_TEXTSTRUCTUREMODEL_API_KEY`: API key for authentication | ||
| - `LIGHTRAG_LITELLM_TEXTSTRUCTUREMODEL_API_VERSION`: API version | ||
|
|
||
| ## Embedding Model | ||
| **LIGHTRAG_LITELLM_EMBEDDING_MODEL**: Used by lightrag to create embeddings for text | ||
| - Required Configurations: | ||
| - `LIGHTRAG_LITELLM_EMBEDDING_MODEL`: Model identifier (e.g., azure/text-embedding-ada-002) | ||
| - `LIGHTRAG_LITELLM_EMBEDDING_API_BASE`: Base URL for the embedding model API | ||
| - `LIGHTRAG_LITELLM_EMBEDDING_API_KEY`: API key for authentication | ||
| - `LIGHTRAG_LITELLM_EMBEDDING_API_VERSION`: API version | ||
|
|
||
| ## Inference Model | ||
| **LIGHTRAG_LITELLM_INFERENCE_MODEL**: Used for responding to queries with auto-select capability | ||
| - Required Configurations: | ||
| - `LIGHTRAG_LITELLM_INFERENCE_MODEL`: Model identifier (default: anthropic/claude-3-5-sonnet-20240620) | ||
| - `LIGHTRAG_LITELLM_INFERENCE_API_KEY`: API key for authentication | ||
|
|
||
| ## Additional Audio LightRAG Configurations | ||
|
|
||
| ### Audio Processing Settings | ||
| - `AUDIO_LIGHTRAG_CONVERSATION_HISTORY_NUM`: Number of conversation history items to maintain (default: 10) | ||
| - `AUDIO_LIGHTRAG_TIME_THRESHOLD_SECONDS`: Time threshold for audio processing in seconds (default: 60) | ||
| - `AUDIO_LIGHTRAG_MAX_AUDIO_FILE_SIZE_MB`: Maximum allowed audio file size in MB (default: 15) | ||
| - `AUDIO_LIGHTRAG_TOP_K_PROMPT`: Top K value for prompt processing (default: 100) | ||
|
|
||
| ### Feature Flags | ||
| - `ENABLE_AUDIO_LIGHTRAG_INPUT`: Enable/disable audio input processing (default: false) | ||
| - `AUTO_SELECT_ENABLED`: Enable/disable auto-select feature (default: false) | ||
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,9 +51,7 @@ async def load(self) -> None: | |
| logger.exception(f"Error in getting contextual transcript : {e}") | ||
| continue | ||
| previous_contextual_transcript = '\n\n'.join(previous_contextual_transcript_li) | ||
| audio_model_prompt = Prompts.audio_model_system_prompt() | ||
| audio_model_prompt = audio_model_prompt.format(event_text = event_text, | ||
| previous_conversation_text = previous_contextual_transcript) | ||
| audio_model_prompt = Prompts.audio_model_system_prompt(event_text, previous_contextual_transcript) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ArindamRoy23 change to use prompts.py |
||
| try: | ||
| response = directus.get_item('conversation_segment', int(segment_id)) | ||
| except Exception as e: | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ussaama change your FF to ENABLE_AUTO_SELECT