From b82ddf9cfbf89cb1001229344f4958c099b3bd7e Mon Sep 17 00:00:00 2001 From: Alonso Silva Allende Date: Tue, 20 Jun 2023 07:21:01 +0200 Subject: [PATCH] Improve error message (#6275) Trying to use OpenAI models like 'text-davinci-002' or 'text-davinci-003' the agent doesn't work and the message is 'Only supported with OpenAI models.' The error message should be 'Only supported with ChatOpenAI models.' My Twitter handle is @alonsosilva Fixes # (issue) #### Before submitting #### Who can review? Tag maintainers/contributors who might be interested: @hwchase17 Co-authored-by: SILVA Alonso Co-authored-by: Harrison Chase --- langchain/agents/openai_functions_agent/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/agents/openai_functions_agent/base.py b/langchain/agents/openai_functions_agent/base.py index 87108e5f..704cbf04 100644 --- a/langchain/agents/openai_functions_agent/base.py +++ b/langchain/agents/openai_functions_agent/base.py @@ -290,7 +290,7 @@ class OpenAIFunctionsAgent(BaseSingleActionAgent): ) -> BaseSingleActionAgent: """Construct an agent from an LLM and tools.""" if not isinstance(llm, ChatOpenAI): - raise ValueError("Only supported with OpenAI models.") + raise ValueError("Only supported with ChatOpenAI models.") prompt = cls.create_prompt( extra_prompt_messages=extra_prompt_messages, system_message=system_message,