A programming framework for agentic AI
Use native logger formatter (#3594)
Eric Zhu32166b5e3e95
diff --git a/autogen/oai/client.py b/autogen/oai/client.pyindex cbabe93d8..833cc7772 100644--- a/autogen/oai/client.py+++ b/autogen/oai/client.py@@ -6,7 +6,6 @@ import sysimport uuidfrom typing import Any, Callable, Dict, List, Optional, Protocol, Tuple, Union-from flaml.automl.logger import logger_formatterfrom pydantic import BaseModelfrom autogen.cache import Cache@@ -16,6 +15,7 @@ from autogen.oai.openai_utils import OAI_PRICE1K, get_keyfrom autogen.runtime_logging import log_chat_completion, log_new_client, log_new_wrapper, logging_enabledfrom autogen.token_count_utils import count_token+from .client_utils import logger_formatterfrom .rate_limiters import RateLimiter, TimeRateLimiterTOOL_ENABLED = Falsediff --git a/autogen/oai/client_utils.py b/autogen/oai/client_utils.pyindex 55730485b..5da4c49c2 100644--- a/autogen/oai/client_utils.py+++ b/autogen/oai/client_utils.py@@ -1,8 +1,13 @@"""Utilities for client classes"""+import loggingimport warningsfrom typing import Any, Dict, List, Optional, Tuple+logger_formatter = logging.Formatter(+ "[%(name)s: %(asctime)s] {%(lineno)d} %(levelname)s - %(message)s", "%m-%d %H:%M:%S"+)+def validate_parameter(params: Dict[str, Any],diff --git a/autogen/oai/cohere.py b/autogen/oai/cohere.pyindex e9a89c9ca..cd30c74dd 100644--- a/autogen/oai/cohere.py+++ b/autogen/oai/cohere.py@@ -31,12 +31,11 @@ from typing import Any, Dict, Listfrom cohere import Client as Coherefrom cohere.types import ToolParameterDefinitionsValue, ToolResult-from flaml.automl.logger import logger_formatterfrom openai.types.chat import ChatCompletion, ChatCompletionMessageToolCallfrom openai.types.chat.chat_completion import ChatCompletionMessage, Choicefrom openai.types.completion_usage import CompletionUsage-from autogen.oai.client_utils import validate_parameter+from .client_utils import logger_formatter, validate_parameterlogger = logging.getLogger(__name__)if not logger.handlers:diff --git a/autogen/oai/completion.py b/autogen/oai/completion.pyindex 5a62cde33..d4866d345 100644--- a/autogen/oai/completion.py+++ b/autogen/oai/completion.py@@ -8,9 +8,9 @@ from typing import Callable, Dict, List, Optional, Unionimport numpy as npfrom flaml import BlendSearch, tune-from flaml.automl.logger import logger_formatterfrom flaml.tune.space import is_constant+from .client_utils import logger_formatterfrom .openai_utils import get_keytry: