Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using Huggingface inference #2133

Open
Himasnhu-AT opened this issue Feb 15, 2025 · 2 comments
Open

Error when using Huggingface inference #2133

Himasnhu-AT opened this issue Feb 15, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@Himasnhu-AT
Copy link

Context:

I'm trying out using Agno with hugging face inference, but getting an error.

question:

How can i create my own tools and use them with agents

ERROR details:

agent = Agent(
    model=HuggingFace(
        id="meta-llama/Meta-Llama-3-70B-Instruct",
    ),
    tools=[DuckDuckGoTools(), Newspaper4kTools()],
    description="You are a senior NYT researcher writing an article on a topic.",
    instructions=[
        "For a given topic, search for the top 5 links.",
        "Then read each URL and extract the article text, if a URL isn't available, ignore it.",
        "Analyse and prepare an NYT worthy article based on the information.",
    ],
    markdown=True,
    show_tool_calls=True,
    add_datetime_to_instructions=True,
)

agent.print_response("Simulation theory", stream=True)

Error:

▰▰▰▰▰▰▱ Thinking...
┏━ Message ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃                                                                                                                 ┃
┃ Simulation theory                                                                                               ┃
┃                                                                                                                 ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-38-576a1e1a3861>](https://localhost:8080/#) in <cell line: 0>()
     32 )
     33 
---> 34 agent.print_response("Simulation theory", stream=True)

3 frames
[/usr/local/lib/python3.11/dist-packages/agno/agent/agent.py](https://localhost:8080/#) in print_response(self, message, messages, audio, images, videos, stream, markdown, show_message, show_reasoning, show_full_reasoning, console, tags_to_include_in_markdown, **kwargs)
   3358                 if render:
   3359                     live_log.update(Group(*panels))
-> 3360                 for resp in self.run(
   3361                     message=message, messages=messages, audio=audio, images=images, videos=videos, stream=True, **kwargs
   3362                 ):

[/usr/local/lib/python3.11/dist-packages/agno/agent/agent.py](https://localhost:8080/#) in _run(self, message, stream, audio, images, videos, messages, stream_intermediate_steps, **kwargs)
    532         if self.stream:
    533             model_response = ModelResponse(content="")
--> 534             for model_response_chunk in self.model.response_stream(messages=run_messages.messages):
    535                 # If the model response is an assistant_response, yield a RunResponse with the content
    536                 if model_response_chunk.event == ModelResponseEvent.assistant_response.value:

[/usr/local/lib/python3.11/dist-packages/agno/models/base.py](https://localhost:8080/#) in response_stream(self, messages)
    455                 assistant_message.audio_output = stream_data.response_audio
    456             if stream_data.response_tool_calls and len(stream_data.response_tool_calls) > 0:
--> 457                 assistant_message.tool_calls = self.parse_tool_calls(stream_data.response_tool_calls)
    458 
    459             # Add assistant message to messages

[/usr/local/lib/python3.11/dist-packages/agno/models/huggingface/huggingface.py](https://localhost:8080/#) in parse_tool_calls(tool_calls_data)
    327         for _tool_call in tool_calls_data:
    328             _index = _tool_call.index
--> 329             _tool_call_id = _tool_call.id
    330             _tool_call_type = _tool_call.type
    331             _function_name = _tool_call.function.name if _tool_call.function else None

AttributeError: 'str' object has no attribute 'id'
@dirkbrnd dirkbrnd added the bug Something isn't working label Feb 15, 2025
@manthanguptaa
Copy link
Contributor

Hey @Himasnhu-AT! Thanks so much for raising this issue. I was able to replicate it on my end, too. We’ll make it a priority to fix this as soon as possible. Really appreciate your patience, and feel free to reach out if you have any more questions or concerns in the meantime!

@wakeupmh
Copy link

relates to: #2161 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants