mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
Fix CI failures: resolve type checker errors and test failures
- Fix type checker errors in reasoning_handler.py: handle Union[str, dict] response types - Fix type checker error in crew_chat.py: convert final_response to string for dict - Update test_task_callback_returns_task_output to include completion_metadata field - Fix integration test attribute access in test_lite_agent_with_xml_extraction Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -246,7 +246,7 @@ def handle_user_input(
|
||||
available_functions=available_functions,
|
||||
)
|
||||
|
||||
messages.append({"role": "assistant", "content": final_response})
|
||||
messages.append({"role": "assistant", "content": str(final_response)})
|
||||
click.secho(f"\nAssistant: {final_response}\n", fg="green")
|
||||
|
||||
|
||||
|
||||
@@ -260,14 +260,22 @@ class AgentReasoning:
|
||||
available_functions={"create_reasoning_plan": _create_reasoning_plan},
|
||||
)
|
||||
|
||||
self.logger.debug(f"Function calling response: {response[:100]}...")
|
||||
|
||||
try:
|
||||
result = json.loads(response)
|
||||
if "plan" in result and "ready" in result:
|
||||
return result["plan"], result["ready"]
|
||||
except (json.JSONDecodeError, KeyError):
|
||||
pass
|
||||
if isinstance(response, dict):
|
||||
response_str = str(response)
|
||||
self.logger.debug(f"Function calling response: {response_str[:100]}...")
|
||||
|
||||
if "plan" in response and "ready" in response:
|
||||
return response["plan"], response["ready"]
|
||||
else:
|
||||
response_str = str(response)
|
||||
self.logger.debug(f"Function calling response: {response_str[:100]}...")
|
||||
|
||||
try:
|
||||
result = json.loads(response_str)
|
||||
if "plan" in result and "ready" in result:
|
||||
return result["plan"], result["ready"]
|
||||
except (json.JSONDecodeError, KeyError):
|
||||
pass
|
||||
|
||||
response_str = str(response)
|
||||
return response_str, "READY: I am ready to execute the task." in response_str
|
||||
|
||||
@@ -162,6 +162,7 @@ def test_task_callback_returns_task_output():
|
||||
"name": None,
|
||||
"expected_output": "Bullet point list of 5 interesting ideas.",
|
||||
"output_format": OutputFormat.RAW,
|
||||
"completion_metadata": None,
|
||||
}
|
||||
assert output_dict == expected_output
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class TestIntegrationLLMFeatures:
|
||||
|
||||
result = lite_agent.kickoff("Analyze this problem")
|
||||
|
||||
thinking_content = extract_xml_content(result.raw, "thinking")
|
||||
thinking_content = extract_xml_content(result, "thinking")
|
||||
assert thinking_content is not None
|
||||
assert "step by step" in thinking_content
|
||||
assert "requirements" in thinking_content
|
||||
|
||||
Reference in New Issue
Block a user