microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
31.39k stars 4.58k forks source link

[Bug]: Error when using logging: [file_logger] Failed to log event Object of type OpenAIWrapper is not JSON serializable #3249

Open tyler-suard-parker opened 2 months ago

tyler-suard-parker commented 2 months ago

Describe the bug

I am using this tutorial: https://microsoft.github.io/autogen/docs/notebooks/agentchat_logging/ for the syntax of logging, but it is not working for me. I get the above error.

Steps to reproduce

logging_session_id = autogen.runtime_logging.start(
    logger_type="file", config={"filename": "autogen_log.log"}
)

(run some agents)

Model Used

gpt-4

Expected Behavior

The log should have generated token usage

Screenshots and logs

No response

Additional Information

No response

tyler-suard-parker commented 2 months ago

Additionally, the logger is not showing the token usage.

wenngong commented 2 months ago

@tyler-suard-parker my code works well without error. Can you provide the entire example codes for reproduce it?