fix: handle unsupported LLM exception message (#4199)

* fix: handle unsupported LLM exception message

* Update src/backend/base/langflow/components/agents/ToolCallingAgent.py

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Ítalo Johnny 2024-10-19 10:47:31 -03:00 committed by GitHub
commit c24b0d9ac4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -43,4 +43,8 @@ class ToolCallingAgentComponent(LCToolsAgentComponent):
("placeholder", "{agent_scratchpad}"),
]
prompt = ChatPromptTemplate.from_messages(messages)
return create_tool_calling_agent(self.llm, self.tools, prompt)
try:
return create_tool_calling_agent(self.llm, self.tools, prompt)
except NotImplementedError as e:
message = f"{self.display_name} does not support tool calling." "Please try using a compatible model."
raise NotImplementedError(message) from e