autogen.logger.base_logger.BaseLogger
BaseLogger
Helper class that provides a standard way to create an ABC using inheritance.
Instance Methods
get_connection
Return a connection to the logging database.
log_chat_completion
Log a chat completion to database.
In AG2, 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.
Name | Description |
---|---|
invocation_id | A unique identifier for the invocation to the OpenAIWrapper.create method call Type: uuid.UUID |
client_id | A unique identifier for the underlying OpenAI client instance Type: int |
wrapper_id | A unique identifier for the OpenAIWrapper instance Type: int |
source | The source/creator of the event as a string name or an Agent instance Type: str | Agent |
request | A dictionary representing the request or call to the OpenAI client endpoint Type: dict[str, float | str | list[dict[str, str]]] |
response | The response from OpenAI Type: str | ChatCompletion |
is_cached | 1 if the response was a cache hit, 0 otherwise Type: int |
cost | The cost for OpenAI response Type: float |
start_time | A string representing the moment the request was initiated Type: str |
log_event
Log an event for an agent.
Name | Description |
---|---|
source | The source/creator of the event as a string name or an Agent instance Type: str | Agent |
name | The name of the event Type: str |
**kwargs | Type: dict[str, Any] |
log_function_use
Log the use of a registered function (could be a tool)
Parameters:Name | Description |
---|---|
source | The source/creator of the event as a string name or an Agent instance Type: str | Agent |
function | The function information Type: F |
args | The function args to log Type: dict[str, Any] |
returns | The return Type: Any |
log_new_agent
Log the birth of a new agent.
Name | Description |
---|---|
agent | The agent to log. Type: ConversableAgent |
init_args | The arguments passed to the construct the conversable agent Type: dict[str, Any] |
log_new_client
Log the birth of a new OpenAIWrapper.
Name | Description |
---|---|
client | Type: AzureOpenAIÂ |Â OpenAI |
wrapper | The OpenAI client to log. Type: OpenAIWrapper |
init_args | The arguments passed to the construct the client Type: dict[str, Any] |
log_new_wrapper
Log the birth of a new OpenAIWrapper.
Name | Description |
---|---|
wrapper | The wrapper to log. Type: OpenAIWrapper |
init_args | The arguments passed to the construct the wrapper Type: dict[str, LLMConfig | list[LLMConfig]] |
start
Open a connection to the logging database, and start recording.
Returns:
session_id (str): a unique id for the logging session
Type | Description |
---|---|
str | session_id (str): a unique id for the logging session |
stop
Close the connection to the logging database, and stop logging.