logger
logger.base_logger
BaseLogger
start
Open a connection to the logging database, and start recording.
Returns:
session_id
str - a unique id for the logging session
log_chat_completion
Log a chat completion to database.
In AutoGen, chat completions are somewhat complicated because they are handled by the autogen.oai.OpenAIWrapper
class.
One invocation to create
can lead to multiple underlying OpenAI calls, depending on the llm_config list used, and
any errors or retries.
Arguments:
invocation_id
uuid - A unique identifier for the invocation to the OpenAIWrapper.create method callclient_id
int - A unique identifier for the underlying OpenAI client instancewrapper_id
int - A unique identifier for the OpenAIWrapper instancesource
str or Agent - The source/creator of the event as a string name or an Agent instancerequest
dict - A dictionary representing the request or call to the OpenAI client endpointresponse
str or ChatCompletion - The response from OpenAIis_cached
int - 1 if the response was a cache hit, 0 otherwisecost(float)
- The cost for OpenAI responsestart_time
str - A string representing the moment the request was initiated
log_new_agent
Log the birth of a new agent.
Arguments:
agent
ConversableAgent - The agent to log.init_args
dict - The arguments passed to the construct the conversable agent
log_event
Log an event for an agent.
Arguments:
source
str or Agent - The source/creator of the event as a string name or an Agent instancename
str - The name of the eventkwargs
dict - The event information to log
log_new_wrapper
Log the birth of a new OpenAIWrapper.
Arguments:
wrapper
OpenAIWrapper - The wrapper to log.init_args
dict - The arguments passed to the construct the wrapper
log_new_client
Log the birth of a new OpenAIWrapper.
Arguments:
wrapper
OpenAI - The OpenAI client to log.init_args
dict - The arguments passed to the construct the client
log_function_use
Log the use of a registered function (could be a tool)
Arguments:
source
str or Agent - The source/creator of the event as a string name or an Agent instancefunction
F - The function informationargs
dict - The function args to logreturns
any - The return
stop
Close the connection to the logging database, and stop logging.
get_connection
Return a connection to the logging database.