跳到主要内容

logger.file_logger

文件记录器

class FileLogger(BaseLogger)

开始

def start() -> str

启动记录器并返回session_id。

log_chat_completion

def log_chat_completion(invocation_id: uuid.UUID, client_id: int,
wrapper_id: int, source: Union[str, Agent],
request: Dict[str, Union[float, str, List[Dict[str,
str]]]],
response: Union[str, ChatCompletion], is_cached: int,
cost: float, start_time: str) -> None

记录一次聊天完成。

log_new_agent

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

记录一个新的代理实例。

log_event

def log_event(source: Union[str, Agent], name: str,
**kwargs: Dict[str, Any]) -> None

从代理或字符串源记录一个事件。

log_new_wrapper

def log_new_wrapper(
wrapper: OpenAIWrapper,
init_args: Dict[str, Union[LLMConfig, List[LLMConfig]]] = {}) -> None

记录一个新的包装器实例。

记录新客户端

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

记录一个新客户实例。

日志函数使用

def log_function_use(source: Union[str, Agent], function: F,
args: Dict[str, Any], returns: Any) -> None

记录一个已注册函数(可以是一个工具)由代理或字符串源使用的情况。

get_connection

def get_connection() -> None

该方法故意留空,因为FileLogger不需要特定的连接。

停止

def stop() -> None

关闭文件处理程序并将其从日志记录器中移除。