microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
32.65k stars 4.75k 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 3 months ago

tyler-suard-parker commented 3 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 3 months ago

Additionally, the logger is not showing the token usage.

wenngong commented 3 months ago

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