Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bboynton97 committed Jun 4, 2024
1 parent 7ce5af0 commit b019d94
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion autogen/logger/sqlite_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def log_chat_completion(
cost,
start_time,
end_time,
source.name
source.name,
)

self._run_query(query=query, args=args)
Expand Down
7 changes: 4 additions & 3 deletions test/agentchat/test_agent_file_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
import tempfile
import uuid
from typing import Callable, Any
from typing import Any, Callable

import pytest

Expand All @@ -23,6 +23,7 @@
def dummy_function(param1: str, param2: int) -> Any:
return param1 * param2


@pytest.mark.skipif(is_windows, reason="Skipping file logging tests on Windows")
@pytest.fixture
def logger() -> FileLogger:
Expand Down Expand Up @@ -64,7 +65,7 @@ def test_log_chat_completion(logger: FileLogger):
is_cached=is_cached,
cost=cost,
start_time=start_time,
source=agent
source=agent,
)

with open(logger.log_file, "r") as f:
Expand All @@ -86,7 +87,7 @@ def test_log_chat_completion(logger: FileLogger):
def test_log_function_use(logger: FileLogger):
source = autogen.AssistantAgent(name="TestAgent", code_execution_config=False)
func: Callable[[str, int], Any] = dummy_function
args = {'foo': 'bar'}
args = {"foo": "bar"}
returns = True

logger.log_function_use(source=source, function=func, args=args, returns=returns)
Expand Down
9 changes: 5 additions & 4 deletions test/test_logging.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import sqlite3
import uuid
from typing import Callable, Any
from typing import Any, Callable
from unittest.mock import Mock, patch

import pytest
Expand Down Expand Up @@ -66,6 +66,7 @@
def dummy_function(param1: str, param2: int) -> Any:
return param1 * param2


###############################################################


Expand All @@ -89,7 +90,7 @@ def get_sample_chat_completion(response):
"is_cached": 0,
"cost": 0.347,
"start_time": get_current_ts(),
"agent": autogen.AssistantAgent(name="TestAgent", code_execution_config=False)
"agent": autogen.AssistantAgent(name="TestAgent", code_execution_config=False),
}


Expand Down Expand Up @@ -129,13 +130,13 @@ def test_log_function_use(db_connection):

source = autogen.AssistantAgent(name="TestAgent", code_execution_config=False)
func: Callable[[str, int], Any] = dummy_function
args = {'foo': 'bar'}
args = {"foo": "bar"}
returns = True

autogen.runtime_logging.log_function_use(agent=source, function=func, args=args, returns=returns)

query = """
SELECT source_id, source_name, function_name, args, returns, timestamp
SELECT source_id, source_name, function_name, args, returns, timestamp
FROM function_calls
"""

Expand Down

0 comments on commit b019d94

Please sign in to comment.