Skip to content

Commit

Permalink
update loggers (#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
lazToum authored Feb 6, 2025
1 parent da5ff48 commit d35bea2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion autogen/logger/file_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ def log_chat_completion(
) -> None:
"""Log a chat completion."""
thread_id = threading.get_ident()
source_name = source if isinstance(source, str) else source.name
source_name = (
source
if isinstance(source, str)
else source.name
if hasattr(source, "name") and source.name is not None
else ""
)
try:
log_data = json.dumps(
{
Expand Down
8 changes: 7 additions & 1 deletion autogen/logger/sqlite_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,13 @@ def log_chat_completion(
else:
response_messages = json.dumps(to_dict(response), indent=4)

source_name = source if isinstance(source, str) else source.name
source_name = (
source
if isinstance(source, str)
else source.name
if hasattr(source, "name") and source.name is not None
else ""
)

query = """
INSERT INTO chat_completions (
Expand Down

0 comments on commit d35bea2

Please sign in to comment.