Commit Graph

2 Commits

Author SHA1 Message Date
Devin AI
7fb8999545 fix: only pass tools parameter when tools are available
This fixes the CI test failures by only passing the tools parameter to
llm.call() and llm.acall() when tools are actually available. This
maintains backward compatibility with existing code that checks
'tools' in kwargs to determine if tools were provided.

The previous commit always passed tools=None, which caused tests that
check 'tools' in kwargs to fail because the key was always present.

Co-Authored-By: João <joao@crewai.com>
2026-01-14 22:54:18 +00:00
Devin AI
d97d58d2c3 fix: pass tools to llm.call() for native function calling support
This fixes issue #4238 where Gemini models fail with UNEXPECTED_TOOL_CALL
errors because tools were not being passed to the LLM call.

Changes:
- Add _extract_tools_from_context() helper function to extract tools from
  executor context (CrewAgentExecutor or LiteAgent) and convert them to
  dict format compatible with LLM providers
- Update get_llm_response() to extract and pass tools to llm.call()
- Update aget_llm_response() to extract and pass tools to llm.acall()
- Add comprehensive tests for the new functionality

Co-Authored-By: João <joao@crewai.com>
2026-01-14 22:48:48 +00:00