mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
Handle minor issue: tools name shouldn't contain space for openai (#961)
As per (https://github.com/langchain-ai/langchain/pull/16395), OpenAI functions don't accept tool names with space. Therefore, I added an exception handling snippet to raise an issue if a custom tool name has a space.
This commit is contained in:
@@ -72,6 +72,13 @@ class ToolUsage:
|
|||||||
self.action = action
|
self.action = action
|
||||||
self.function_calling_llm = function_calling_llm
|
self.function_calling_llm = function_calling_llm
|
||||||
|
|
||||||
|
# Handling bug (see https://github.com/langchain-ai/langchain/pull/16395): raise an error if tools_names have space for ChatOpenAI
|
||||||
|
if isinstance(self.function_calling_llm, ChatOpenAI):
|
||||||
|
if " " in self.tools_names:
|
||||||
|
raise Exception(
|
||||||
|
"Tools names should not have spaces for ChatOpenAI models."
|
||||||
|
)
|
||||||
|
|
||||||
# Set the maximum parsing attempts for bigger models
|
# Set the maximum parsing attempts for bigger models
|
||||||
if (isinstance(self.function_calling_llm, ChatOpenAI)) and (
|
if (isinstance(self.function_calling_llm, ChatOpenAI)) and (
|
||||||
self.function_calling_llm.openai_api_base is None
|
self.function_calling_llm.openai_api_base is None
|
||||||
|
|||||||
Reference in New Issue
Block a user