> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ag2.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.logger.SqliteLogger

<h2 id="autogen.logger.SqliteLogger" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">SqliteLogger</span>
</h2>

```python theme={null}
SqliteLogger(config: dict[str, Any])
```

Sqlite logger class.<br />Initialize the SqliteLogger.<br />

<b>Parameters:</b>

| Name     | Description               |
| -------- | ------------------------- |
| `config` | **Type:** dict\[str, Any] |

### Class Attributes

<code class="doc-symbol doc-symbol-heading doc-symbol-attribute" />

#### schema\_version

<br />

<br />

### Instance Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### get\_connection

```python theme={null}
get_connection(self) -> None | Connection
```

Get connection.

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_chat\_completion

```python theme={null}
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 chat completion.<br />

<b>Parameters:</b>

| Name            | Description                                                                                              |
| --------------- | -------------------------------------------------------------------------------------------------------- |
| `invocation_id` | Invocation ID.<br /><br />**Type:** uuid.UUID                                                            |
| `client_id`     | Client ID.<br /><br />**Type:** int                                                                      |
| `wrapper_id`    | Wrapper ID.<br /><br />**Type:** int                                                                     |
| `source`        | Source of the chat completion.<br /><br />**Type:** str \| Agent                                         |
| `request`       | Request for the chat completion.<br /><br />**Type:** dict\[str, float \| str \| list\[dict\[str, str]]] |
| `response`      | Response for the chat completion.<br /><br />**Type:** str \| ChatCompletion                             |
| `is_cached`     | Whether the response is cached.<br /><br />**Type:** int                                                 |
| `cost`          | Cost of the chat completion.<br /><br />**Type:** float                                                  |
| `start_time`    | Start time of the chat completion.<br /><br />**Type:** str                                              |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_event

```python theme={null}
log_event(
    self,
    source: str | Agent,
    name: str,
    **kwargs: dict[str, Any]
) -> None
```

Log event.<br />

<b>Parameters:</b>

| Name       | Description                                                              |
| ---------- | ------------------------------------------------------------------------ |
| `source`   | Source of the event.<br /><br />**Type:** str \| Agent                   |
| `name`     | Name of the event.<br /><br />**Type:** str                              |
| `**kwargs` | Additional arguments for the event.<br /><br />**Type:** dict\[str, Any] |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_function\_use

```python theme={null}
log_function_use(
    self,
    source: str | Agent,
    function: F,
    args: dict[str, Any],
    returns: Any
) -> None
```

Log function use.<br />

<b>Parameters:</b>

| Name       | Description                                                     |
| ---------- | --------------------------------------------------------------- |
| `source`   | Source of the function use.<br /><br />**Type:** str \| Agent   |
| `function` | Function to log.<br /><br />**Type:** F                         |
| `args`     | Arguments of the function.<br /><br />**Type:** dict\[str, Any] |
| `returns`  | Returns of the function.<br /><br />**Type:** Any               |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_new\_agent

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

Log new agent.<br />

<b>Parameters:</b>

| Name        | Description                                                                |
| ----------- | -------------------------------------------------------------------------- |
| `agent`     | Agent to log.<br /><br />**Type:** ConversableAgent                        |
| `init_args` | Initialization arguments of the agent<br /><br />**Type:** dict\[str, Any] |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_new\_client

```python theme={null}
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 new client.<br />

<b>Parameters:</b>

| Name        | Description                                                                                                                                                                                                        |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `client`    | Client to log.<br /><br />**Type:** AzureOpenAI \| OpenAI \| CerebrasClient \| GeminiClient \| AnthropicClient \| MistralAIClient \| TogetherClient \| GroqClient \| CohereClient \| OllamaClient \| BedrockClient |
| `wrapper`   | Wrapper of the client.<br /><br />**Type:** OpenAIWrapper                                                                                                                                                          |
| `init_args` | Initialization arguments of the client.<br /><br />**Type:** dict\[str, Any]                                                                                                                                       |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### log\_new\_wrapper

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

Log new wrapper.<br />

<b>Parameters:</b>

| Name        | Description                                                                                            |
| ----------- | ------------------------------------------------------------------------------------------------------ |
| `wrapper`   | Wrapper to log.<br /><br />**Type:** OpenAIWrapper                                                     |
| `init_args` | Initialization arguments of the wrapper<br /><br />**Type:** dict\[str, LLMConfig \| list\[LLMConfig]] |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### start

```python theme={null}
start(self) -> str
```

Open a connection to the logging database, and start recording.<br />Returns: <br />    session\_id (str):     a unique id for the logging session

<b>Returns:</b>

| Type | Description                                            |
| ---- | ------------------------------------------------------ |
| str  | session\_id (str): a unique id for the logging session |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### stop

```python theme={null}
stop(self) -> None
```

Stop the logger

<br />
