8000 Unable to use DaprChatClient() as LLM for Agent: dapr_agents.types.exceptions.AgentError: Failed during chat generation: Unsupported format type: dapr · Issue #74 · dapr/dapr-agents · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unable to use DaprChatClient() as LLM for Agent: dapr_agents.types.exceptions.AgentError: Failed during chat generation: Unsupported format type: dapr #74
@ivanignatiev

Description

@ivanignatiev

It will be nice to avoid setting environment variables everywhere and use DaprChatClient() as an abstraction to any LLM and configure all connection settings in DAPR component.

For now, this code:

AIAgent = Actor(
    name = "Stevie",
    role = "Weather Assistant",
    goal = "Assist Humans with weather related tasks.",
    llm = DaprChatClient(),
    instructions = ["Get accurate weather information", "From time to time, you can also jump after answering the weather question."],
    tools=[
        get_weather,
        jump
    ]
)

AIAgent.run("What is the weather in Virginia, New York and Washington DC?")

Fails with an exception:

== APP == Unsupported format type: dapr
== APP == Error during chat generation: Unsupported format type: dapr
== APP == Traceback (most recent call last):
== APP ==   File "/home/ignatiev/projects/dapr-ai-agents/.venv/lib/python3.12/site-packages/dapr_agents/agent/patterns/toolcall/base.py", line 105, in process_iterations
== APP == user:
== APP == What is the weather in Virginia, New York and Washington DC?
== APP == 
== APP == --------------------------------------------------------------------------------
== APP == 
== APP ==     response: ChatCompletion = self.llm.generate(messages=messages, tools=self.tools, tool_choice=self.tool_choice)
== APP ==                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/home/ignatiev/projects/dapr-ai-agents/.venv/lib/python3.12/site-packages/dapr_agents/llm/dapr/chat.py", line 146, in generate
== APP ==     params = RequestHandler.process_params(
== APP ==              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/home/ignatiev/projects/dapr-ai-agents/.venv/lib/python3.12/site-packages/dapr_agents/llm/utils/request.py", line 99, in process_params
== APP ==     params['tools'] = [ToolHelper.format_tool(tool, tool_format=llm_provider) for tool in tools]
== APP ==                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/home/ignatiev/projects/dapr-ai-agents/.venv/lib/python3.12/site-packages/dapr_agents/tool/utils/tool.py", line 50, in format_tool
== APP ==     return tool.to_function_call(format_type=tool_format, use_deprecated=use_deprecated)
== APP ==            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/home/ignatiev/projects/dapr-ai-agents/.venv/lib/python3.12/site-packages/dapr_agents/tool/base.py", line 167, in to_function_call
== APP ==     return to_function_call_definition(self.name, self.description, self.args_model, format_type, use_deprecated)
== APP ==            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/home/ignatiev/projects/dapr-ai-agents/.venv/lib/python3.12/site-packages/dapr_agents/tool/utils/function_calling.py", line 136, in to_function_call_definition
== APP ==     raise FunCallBuilderError(f"Unsupported format type: {format_type}")
== APP == dapr_agents.types.exceptions.FunCallBuilderError: Unsupported format type: dapr
== APP == 
== APP == The above exception was the direct cause of the following exception:
== APP == 
== APP == Traceback (most recent call last):
== APP ==   File "/home/ignatiev/projects/dapr-ai-agents/./weather_agent/weather_agent.py", line 42, in <module>
== APP ==     AIAgent.run("What is the weather in Virginia, New York and Washington DC?")
== APP ==   File "/home/ignatiev/projects/dapr-ai-agents/.venv/lib/python3.12/site-packages/dapr_agents/agent/patterns/toolcall/base.py", line 61, in run
== APP ==     return self.process_iterations(messages)
== APP ==            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP ==   File "/home/ignatiev/projects/dapr-ai-agents/.venv/lib/python3.12/site-packages/dapr_agents/agent/patterns/toolcall/base.py", line 119, in process_iterations
== APP ==     raise AgentError(f"Failed during chat generation: {e}") from e
== APP == dapr_agents.types.exceptions.AgentError: Failed during chat generation: Unsupported format type: dapr

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0