Skip to content

Commit

Permalink
include - exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
sonichi committed Apr 14, 2024
1 parent 8beb253 commit 97856b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions autogen/agentchat/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Any, Callable, Dict, List, Tuple, Union
from typing import Any, Callable, Dict, List, Union

from .agent import Agent

Expand Down Expand Up @@ -87,8 +87,8 @@ def aggregate_summary(usage_summary: Dict[str, Any], agent_summary: Dict[str, An

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

return {
"usage_including_cached_inference": usage_including_cached_inference,
Expand Down
11 changes: 4 additions & 7 deletions test/agentchat/test_agent_usage.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
#!/usr/bin/env python3 -m pytest

import io
import os
import sys
from contextlib import redirect_stdout

import pytest
from conftest import skip_openai
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST

import autogen
from autogen import AssistantAgent, UserProxyAgent, gather_usage_summary

try:
import openai
except ImportError:
skip = True
else:
skip = False or skip_openai
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from conftest import skip_openai as skip # noqa: E402


@pytest.mark.skipif(skip, reason="openai not installed OR requested to skip")
Expand Down

0 comments on commit 97856b9

Please sign in to comment.