Skip to content

[Bug]: chat_result.cost for Swarm Agents not working #103

Open
@bassilkhilo

Description

@bassilkhilo

Describe the bug

When I try to get the cost of the chat, it returns the default:

usage_including_cached_inference = {"total_cost": 0}
usage_excluding_cached_inference = {"total_cost": 0}

Steps to reproduce

I think I've identified the issue.

in utils.py the problematic code is:

for agent in agents:
    if getattr(agent, "client", None):
        aggregate_summary(usage_including_cached_inference, agent.client.total_usage_summary)
        aggregate_summary(usage_excluding_cached_inference, agent.client.actual_usage_summary)


I printed the agent in the above for loop, and I see:

<autogen.agentchat.user_proxy_agent.UserProxyAgent object at 0x0000026812CED070>
<autogen.agentchat.groupchat.GroupChatManager object at 0x0000026812CED0D0>

There is no client attr and thus it will always skip the if statement that aggregates the summary. Why, not sure still investigating.

Model Used

gpt-4o-2024-08-06

Expected Behavior

No response

Screenshots and logs

No response

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions