mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 09:08:31 +00:00
Add warning for models like deepseek-r1 using tools
This commit is contained in:
@@ -337,11 +337,23 @@ class ToolUsage:
|
|||||||
return "\n--\n".join(descriptions)
|
return "\n--\n".join(descriptions)
|
||||||
|
|
||||||
def _function_calling(self, tool_string: str):
|
def _function_calling(self, tool_string: str):
|
||||||
model = (
|
supports_function_calling = (
|
||||||
InstructorToolCalling
|
self.function_calling_llm.supports_function_calling()
|
||||||
if self.function_calling_llm.supports_function_calling()
|
|
||||||
else ToolCalling
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not supports_function_calling:
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
warnings.warn(
|
||||||
|
"The model you're using doesn't natively support function calling. "
|
||||||
|
"CrewAI will attempt to use a workaround, but this may be less reliable. "
|
||||||
|
"Consider using a model with native function calling support for better results.",
|
||||||
|
UserWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
|
model = InstructorToolCalling if supports_function_calling else ToolCalling
|
||||||
|
|
||||||
converter = Converter(
|
converter = Converter(
|
||||||
text=f"Only tools available:\n###\n{self._render()}\n\nReturn a valid schema for the tool, the tool name must be exactly equal one of the options, use this text to inform the valid output schema:\n\n### TEXT \n{tool_string}",
|
text=f"Only tools available:\n###\n{self._render()}\n\nReturn a valid schema for the tool, the tool name must be exactly equal one of the options, use this text to inform the valid output schema:\n\n### TEXT \n{tool_string}",
|
||||||
llm=self.function_calling_llm,
|
llm=self.function_calling_llm,
|
||||||
|
|||||||
Reference in New Issue
Block a user