Skip to content

Commit

Permalink
fix: fixing errors arising when the user input contains no tasks, but…
Browse files Browse the repository at this point in the history
… only system instructions
  • Loading branch information
jacopo-chevallard committed Dec 16, 2024
1 parent e48044d commit 4ad60b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/quivr_core/rag/quivr_rag_langgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ class SplittedInput(BaseModel):
class TasksCompletion(BaseModel):
is_task_completable_reasoning: Optional[str] = Field(
default=None,
description="The reasoning that leads to identifying whether the user task or question can be completed using the provided context and chat history.",
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.",
)

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

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

tasks = state["tasks"]
if not tasks.has_tasks():
if not tasks or not tasks.has_tasks():
return {**state}

k = self.retrieval_config.k
Expand Down Expand Up @@ -1031,7 +1031,7 @@ def _build_rag_prompt_inputs(
return {
"context": combine_documents(docs) if docs else "None",
"question": user_question,
"rephrased_task": state["tasks"].definitions,
"rephrased_task": state["tasks"].definitions if state["tasks"] else "None",
"custom_instructions": prompt if prompt else "None",
"files": files if files else "None",
"chat_history": state["chat_history"].to_list(),
Expand Down

0 comments on commit 4ad60b5

Please sign in to comment.