Skip to content

Commit e28f7bc

Browse files
fix: fixing errors arising when the user input contains no tasks (#3525)
We fix an error arising when the user input contains no tasks, but only system instructions # Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
1 parent e48044d commit e28f7bc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/quivr_core/rag/quivr_rag_langgraph.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ class SplittedInput(BaseModel):
7171
class TasksCompletion(BaseModel):
7272
is_task_completable_reasoning: Optional[str] = Field(
7373
default=None,
74-
description="The reasoning that leads to identifying whether the user task or question can be completed using the provided context and chat history.",
74+
description="The reasoning that leads to identifying whether the user task or question can be completed using the provided context and chat history BEFORE any tool is used.",
7575
)
7676

7777
is_task_completable: bool = Field(
78-
description="Whether the user task or question can be completed using the provided context and chat history.",
78+
description="Whether the user task or question can be completed using the provided context and chat history BEFORE any tool is used.",
7979
)
8080

8181
tool_reasoning: Optional[str] = Field(
@@ -667,7 +667,7 @@ async def dynamic_retrieve(self, state: AgentState) -> AgentState:
667667
MAX_ITERATIONS = 3
668668

669669
tasks = state["tasks"]
670-
if not tasks.has_tasks():
670+
if not tasks or not tasks.has_tasks():
671671
return {**state}
672672

673673
k = self.retrieval_config.k
@@ -1031,7 +1031,7 @@ def _build_rag_prompt_inputs(
10311031
return {
10321032
"context": combine_documents(docs) if docs else "None",
10331033
"question": user_question,
1034-
"rephrased_task": state["tasks"].definitions,
1034+
"rephrased_task": state["tasks"].definitions if state["tasks"] else "None",
10351035
"custom_instructions": prompt if prompt else "None",
10361036
"files": files if files else "None",
10371037
"chat_history": state["chat_history"].to_list(),

0 commit comments

Comments
 (0)