FileLogger

FileLogger(config: dict[str, Any])

Helper class that provides a standard way to create an ABC using inheritance.

Parameters:
NameDescription
configType: dict[str, Any]

Instance Methods

get_connection

get_connection(self) -> None

Method is intentionally left blank because there is no specific connection needed for the FileLogger.


log_chat_completion

log_chat_completion(
    self,
    invocation_id: UUID,
    client_id: int,
    wrapper_id: int,
    source: str | Agent,
    request: dict[str, float | str | list[dict[str, str]]],
    response: str | ChatCompletion,
    is_cached: int,
    cost: float,
    start_time: str
) -> None

Log a chat completion.

Parameters:
NameDescription
invocation_idType: uuid.UUID
client_idType: int
wrapper_idType: int
sourceType: str | Agent
requestType: dict[str, float | str | list[dict[str, str]]]
responseType: str | ChatCompletion
is_cachedType: int
costType: float
start_timeType: str

log_event

log_event(
    self,
    source: str | Agent,
    name: str,
    **kwargs: dict[str, Any]
) -> None

Log an event from an agent or a string source.

Parameters:
NameDescription
sourceType: str | Agent
nameType: str
**kwargsType: dict[str, Any]

log_function_use

log_function_use(
    self,
    source: str | Agent,
    function: F,
    args: dict[str, Any],
    returns: Any
) -> None

Log a registered function(can be a tool) use from an agent or a string source.

Parameters:
NameDescription
sourceType: str | Agent
functionType: F
argsType: dict[str, Any]
returnsType: Any

log_new_agent

log_new_agent(
    self,
    agent: ConversableAgent,
    init_args: dict[str, Any] = {}
) -> None

Log a new agent instance.

Parameters:
NameDescription
agentType: ConversableAgent
init_argsType: dict[str, Any]

Default: {}

log_new_client

log_new_client(
    self,
    client: AzureOpenAI | OpenAI | CerebrasClient | GeminiClient | AnthropicClient | MistralAIClient | TogetherClient | GroqClient | CohereClient | OllamaClient | BedrockClient,
    wrapper: OpenAIWrapper,
    init_args: dict[str, Any]
) -> None

Log a new client instance.

Parameters:
NameDescription
clientType: AzureOpenAI | OpenAI | CerebrasClient | GeminiClient | AnthropicClient | MistralAIClient | TogetherClient | GroqClient | CohereClient | OllamaClient | BedrockClient
wrapperType: OpenAIWrapper
init_argsType: dict[str, Any]

log_new_wrapper

log_new_wrapper(
    self,
    wrapper: OpenAIWrapper,
    init_args: dict[str, LLMConfig | list[LLMConfig]] = {}
) -> None

Log a new wrapper instance.

Parameters:
NameDescription
wrapperType: OpenAIWrapper
init_argsType: dict[str, LLMConfig | list[LLMConfig]]

Default: {}

start

start(self) -> str

Start the logger and return the session_id.


stop

stop(self) -> None

Close the file handler and remove it from the logger.