Skip to content

notebook.ipynb - error with agent_res["message"].keys() #2

@ChanduTadanki

Description

@ChanduTadanki
  1. I got an error with the code line if "tool_calls" in agent_res["message"].keys():
    1. Error: 'Message' object has no attribute 'keys'
  2. Diagnosis: I checked the type. It shows: type(agent_res["message"]) as ollama._types.Message
    1. I checked its attributes using agent_res["message"].__dir__() and noticed that it includes dict
  3. Fix: I added dict() so the modified code looks as: if "tool_calls" in agent_res["message"].dict().keys():
    1. That started working fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions