Skip to content

Commit

Permalink
feat: Added default message for no data source!
Browse files Browse the repository at this point in the history
  • Loading branch information
amindadgar committed Dec 17, 2024
1 parent ec93c8b commit d06d194
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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 🙂"
)

0 comments on commit d06d194

Please sign in to comment.