Skip to content

Commit

Permalink
Better error message when no nodes found for Semantic Search.
Browse files Browse the repository at this point in the history
  • Loading branch information
chigkim committed Feb 18, 2024
1 parent 793278d commit 27045f5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions RAG.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def ask(self, question):
self.token_counter.reset_counts()
self.update_settings(self.host, self.llm_name)
node_postprocessors = [SimilarityPostprocessor(similarity_cutoff=settings.similarity_cutoff)]
query_engine = self.index.as_query_engine(similarity_top_k=settings.similarity_top_k, node_postprocessors = node_postprocessors, response_mode=settings.response_mode, streaming=True)
self.response = query_engine.query(question)
return self.response.response_gen
query_engine = self.index.as_query_engine(similarity_top_k=settings.similarity_top_k, node_postprocessors = node_postprocessors, response_mode='no_text')
response = query_engine.query(question)
if response.source_nodes:
query_engine = self.index.as_query_engine(similarity_top_k=settings.similarity_top_k, node_postprocessors = node_postprocessors, response_mode=settings.response_mode, streaming=True)
self.response = query_engine.query(question)
return self.response.response_gen
raise Exception("No texts found for the question using the current rag settings")
2 changes: 1 addition & 1 deletion VOLlama.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 12
version = 13
import wx
import threading
import sounddevice as sd
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Change log

* Better error message for when no text found from semantic search.
* Index file
* Fixed bug when index gets reset when changing model
* Token counter on the status bar for RAG.
Expand Down

0 comments on commit 27045f5

Please sign in to comment.