diff --git a/autogen/logger/sqlite_logger.py b/autogen/logger/sqlite_logger.py index 42809712957..7704a3638fd 100644 --- a/autogen/logger/sqlite_logger.py +++ b/autogen/logger/sqlite_logger.py @@ -250,7 +250,7 @@ def log_chat_completion( cost, start_time, end_time, - source.name + source.name, ) self._run_query(query=query, args=args) diff --git a/test/agentchat/test_agent_file_logging.py b/test/agentchat/test_agent_file_logging.py index 63eef67eb1c..1818b85fa9d 100644 --- a/test/agentchat/test_agent_file_logging.py +++ b/test/agentchat/test_agent_file_logging.py @@ -3,7 +3,7 @@ import sys import tempfile import uuid -from typing import Callable, Any +from typing import Any, Callable import pytest @@ -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: @@ -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: @@ -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) diff --git a/test/test_logging.py b/test/test_logging.py index 0335894ee92..c6f7a182c5c 100644 --- a/test/test_logging.py +++ b/test/test_logging.py @@ -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 @@ -66,6 +66,7 @@ def dummy_function(param1: str, param2: int) -> Any: return param1 * param2 + ############################################################### @@ -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), } @@ -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 """