Skip to content

fix: fixing errors arising when the user input contains no tasks #3525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading