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

feat: Added default message for no data source! #111

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions subquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from llama_index.question_gen.guidance import GuidanceQuestionGenerator
from tc_hivemind_backend.db.utils.preprocess_text import BasePreprocessor
from tc_hivemind_backend.embeddings.cohere import CohereEmbedding
from utils.globals import INVALID_QUERY_RESPONSE
from utils.globals import INVALID_QUERY_RESPONSE, NO_ANSWER_REFERENCE
from utils.qdrant_utils import QDrantUtils
from utils.query_engine import (
DEFAULT_GUIDANCE_SUB_QUESTION_PROMPT_TMPL,
Expand Down Expand Up @@ -228,4 +228,7 @@ def query_multiple_source(
)
response, source_nodes = result

return response.response, source_nodes
if source_nodes == []:
return NO_ANSWER_REFERENCE, source_nodes
else:
return response.response, source_nodes
4 changes: 4 additions & 0 deletions utils/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
"We're unable to process your query. Please refine it and try again."
)
QUERY_ERROR_MESSAGE = "Sorry, we're unable to process your question at the moment. Please try again later."
NO_ANSWER_REFERENCE = (
"Current documentation and community chats draw a blank. "
"Please ask the community manager for intel and we'll take notes for next time 🙂"
)
Loading