Skip to content
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

fix(product-assistant): loop in the schema generation #27111

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion ee/hogai/funnels/test/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_node_runs(self):
new_state,
PartialAssistantState(
messages=[VisualizationMessage(answer=self.schema, plan="Plan", id=new_state.messages[0].id)],
intermediate_steps=None,
intermediate_steps=[],
plan="",
),
)
6 changes: 4 additions & 2 deletions ee/hogai/schema_generator/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def _run_with_prompt(
content=f"Oops! It looks like I’m having trouble generating this {self.INSIGHT_NAME} insight. Could you please try again?"
)
],
intermediate_steps=None,
intermediate_steps=[],
plan="",
)

return PartialAssistantState(
Expand All @@ -115,7 +116,8 @@ def _run_with_prompt(
id=str(uuid4()),
)
],
intermediate_steps=None,
intermediate_steps=[],
plan="",
)

def router(self, state: AssistantState):
Expand Down
10 changes: 6 additions & 4 deletions ee/hogai/schema_generator/test/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def test_node_runs(self):
),
{},
)
self.assertIsNone(new_state.intermediate_steps)
self.assertEqual(new_state.intermediate_steps, [])
self.assertEqual(new_state.plan, "")
self.assertEqual(len(new_state.messages), 1)
self.assertEqual(new_state.messages[0].type, "ai/viz")
self.assertEqual(new_state.messages[0].answer, self.schema)
Expand Down Expand Up @@ -316,7 +317,7 @@ def test_node_leaves_failover(self):
),
{},
)
self.assertIsNone(new_state.intermediate_steps)
self.assertEqual(new_state.intermediate_steps, [])

new_state = node.run(
AssistantState(
Expand All @@ -328,7 +329,7 @@ def test_node_leaves_failover(self):
),
{},
)
self.assertIsNone(new_state.intermediate_steps)
self.assertEqual(new_state.intermediate_steps, [])

def test_node_leaves_failover_after_second_unsuccessful_attempt(self):
node = DummyGeneratorNode(self.team)
Expand All @@ -348,9 +349,10 @@ def test_node_leaves_failover_after_second_unsuccessful_attempt(self):
),
{},
)
self.assertIsNone(new_state.intermediate_steps)
self.assertEqual(new_state.intermediate_steps, [])
self.assertEqual(len(new_state.messages), 1)
self.assertIsInstance(new_state.messages[0], FailureMessage)
self.assertEqual(new_state.plan, "")

def test_agent_reconstructs_conversation_with_failover(self):
action = AgentAction(tool="fix", tool_input="validation error", log="exception")
Expand Down
3 changes: 2 additions & 1 deletion ee/hogai/trends/test/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_node_runs(self):
new_state,
PartialAssistantState(
messages=[VisualizationMessage(answer=self.schema, plan="Plan", id=new_state.messages[0].id)],
intermediate_steps=None,
intermediate_steps=[],
plan="",
),
)
Loading