Runtime Logging with AutoGen
AutoGen offers utilities to log data for debugging and performance analysis. This notebook demonstrates how to use them.
we log data in different modes: - SQlite Database - File
In general, users can initiate logging by calling
autogen.runtime_logging.start()
and stop logging by calling
autogen.runtime_logging.stop()
Getting Data from the SQLite Database
logs.db
should be generated, by default it’s using SQLite database.
You can view the data with GUI tool like sqlitebrowser
, using SQLite
command line shell or using python script:
id | invocation_id | client_id | wrapper_id | session_id | request | response | is_cached | cost | start_time | end_time | total_tokens | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | e8bb00d7-6da5-4407-a949-e19b55d53da8 | 139819167322784 | 139823225568704 | 8821a150-8c78-4d05-a858-8a64f1d18648 | You are a helpful AI assistant. Solve tasks u... | The height of the Eiffel Tower is approximatel... | 1 | 0.01572 | 2024-02-13 15:06:22.082896 | 2024-02-13 15:06:22.083169 | 507 |
1 | 2 | c8522790-0067-484b-bb37-d39ae80db98b | 139823225568656 | 139823225563040 | fb0ef547-a2ac-428b-8c20-a5e63263b8e1 | You are a helpful AI assistant. Solve tasks u... | The height of the Eiffel Tower is approximatel... | 1 | 0.01572 | 2024-02-13 15:06:23.498758 | 2024-02-13 15:06:23.499045 | 507 |
2 | 3 | 91c3f6c0-c6f7-4306-89cd-f304c9556de4 | 139823225449024 | 139819166072448 | 6e08f3e0-392b-434e-8b69-4ab36c4fcf99 | You are a helpful AI assistant. Solve tasks u... | The height of the Eiffel Tower is approximatel... | 1 | 0.01572 | 2024-02-13 15:06:24.688990 | 2024-02-13 15:06:24.689238 | 507 |
Computing Cost
One use case of logging data is to compute the cost of a session.
Log data in File mode
By default, the log type is set to sqlite
as shown above, but we
introduced a new parameter for the autogen.runtime_logging.start()
the logger_type = "file"
will start to log data in the File mode.
This should create a runtime.log
file in your current directory.