fix: handle invalid chunks value in StreamProcessor and ClassicRAG

This commit is contained in:
Siddhant Rai
2025-09-10 22:10:11 +05:30
parent b865a7aec1
commit adcdce8d76
2 changed files with 24 additions and 3 deletions

View File

@@ -25,7 +25,16 @@ class ClassicRAG(BaseRetriever):
self.original_question = source.get("question", "")
self.chat_history = chat_history if chat_history is not None else []
self.prompt = prompt
self.chunks = chunks
if isinstance(chunks, str):
try:
self.chunks = int(chunks)
except ValueError:
logging.warning(
f"Invalid chunks value '{chunks}', using default value 2"
)
self.chunks = 2
else:
self.chunks = chunks
self.gpt_model = gpt_model
self.token_limit = (
token_limit