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

# gemini.AsyncClient

> Async_Client utilities for google gemini model integration and logging utilities.

[View module source on GitHub](https://github.com/maximhq/maxim-py/blob/main/maxim/logger/gemini/async_client.py)

## [MaximGeminiAsyncChatSession](/sdk/python/references/logger/gemini/async_client)

```python theme={null}
class MaximGeminiAsyncChatSession(AsyncChat)
```

[Maxim](/sdk/python/references/maxim) Gemini async chat session.

This class represents a maxim gemini async chat session.

#### \_\_init\_\_

```python theme={null}
def __init__(chat: AsyncChat,
             logger: Logger,
             trace_id: Optional[str] = None,
             is_local_trace: Optional[bool] = False)
```

Initialize a maxim gemini async chat session.

**Arguments**:

| Name             | Description                 |
| ---------------- | --------------------------- |
| `chat`           | The chat.                   |
| `logger`         | The logger.                 |
| `trace_id`       | The trace id.               |
| `is_local_trace` | Whether the trace is local. |

#### send\_message

```python theme={null}
@override
async def send_message(
        message: Union[list[PartUnionDict], PartUnionDict],
        generation_name: Optional[str] = None) -> GenerateContentResponse
```

Send a message to the chat.

**Arguments**:

| Name              | Description                 |
| ----------------- | --------------------------- |
| `message`         | The message to send.        |
| `generation_name` | The name of the generation. |

**Returns**:

| Name                      | Description                 |
| ------------------------- | --------------------------- |
| `GenerateContentResponse` | The response from the chat. |

#### send\_message\_stream

```python theme={null}
@override
async def send_message_stream(
    message: Union[list[PartUnionDict], PartUnionDict],
    generation_name: Optional[str] = None
) -> Awaitable[AsyncIterator[GenerateContentResponse]]
```

Send a message to the chat stream.

**Arguments**:

| Name              | Description                 |
| ----------------- | --------------------------- |
| `message`         | The message to send.        |
| `generation_name` | The name of the generation. |

**Returns**:

| Name                                                | Description                 |
| --------------------------------------------------- | --------------------------- |
| `Awaitable[AsyncIterator[GenerateContentResponse]]` | The response from the chat. |

#### \_\_getattr\_\_

```python theme={null}
def __getattr__(name: str) -> Any
```

Get an attribute from the chat.

**Arguments**:

| Name   | Description                |
| ------ | -------------------------- |
| `name` | The name of the attribute. |

**Returns**:

| Name  | Description    |
| ----- | -------------- |
| `Any` | The attribute. |

#### \_\_setattr\_\_

```python theme={null}
def __setattr__(name: str, value: Any) -> None
```

Set an attribute on the chat.

**Arguments**:

| Name    | Description                 |
| ------- | --------------------------- |
| `name`  | The name of the attribute.  |
| `value` | The value of the attribute. |

#### end\_trace

```python theme={null}
def end_trace()
```

End the trace.

This method ends the trace if it is local and the trace id is not None.

## [MaximGeminiAsyncChats](/sdk/python/references/logger/gemini/async_client)

```python theme={null}
class MaximGeminiAsyncChats(AsyncChats)
```

[Maxim](/sdk/python/references/maxim) Gemini async chats.

This class represents a maxim gemini async chats.

#### \_\_init\_\_

```python theme={null}
def __init__(chats: AsyncChats, logger: Logger)
```

Initialize a maxim gemini async chats.

#### create

```python theme={null}
@override
def create(*,
           model: str,
           config: GenerateContentConfigOrDict = None,
           history: Optional[list[Content]] = None,
           trace_id: Optional[str] = None) -> AsyncChat
```

Create a chat session.

**Arguments**:

| Name       | Description         |
| ---------- | ------------------- |
| `model`    | The model to use.   |
| `config`   | The config to use.  |
| `history`  | The history to use. |
| `trace_id` | The trace id.       |

**Returns**:

| Name        | Description       |
| ----------- | ----------------- |
| `AsyncChat` | The chat session. |

#### \_\_getattr\_\_

```python theme={null}
def __getattr__(name: str) -> Any
```

Get an attribute from the chats.

**Arguments**:

| Name   | Description                |
| ------ | -------------------------- |
| `name` | The name of the attribute. |

**Returns**:

| Name  | Description    |
| ----- | -------------- |
| `Any` | The attribute. |

#### \_\_setattr\_\_

```python theme={null}
def __setattr__(name: str, value: Any) -> None
```

Set an attribute on the chats.

**Arguments**:

| Name    | Description                 |
| ------- | --------------------------- |
| `name`  | The name of the attribute.  |
| `value` | The value of the attribute. |

## [MaximGeminiAsyncModels](/sdk/python/references/logger/gemini/async_client)

```python theme={null}
class MaximGeminiAsyncModels(AsyncModels)
```

[Maxim](/sdk/python/references/maxim) Gemini async models.

This class represents a maxim gemini async models.

#### \_\_init\_\_

```python theme={null}
def __init__(models: AsyncModels, logger: Logger)
```

Initialize a maxim gemini async models.

**Arguments**:

| Name     | Description |
| -------- | ----------- |
| `models` | The models. |
| `logger` | The logger. |

#### generate\_content\_stream

```python theme={null}
@override
async def generate_content_stream(
    *,
    model: str,
    contents: Union[ContentListUnion, ContentListUnionDict],
    config: Optional[GenerateContentConfigOrDict] = None,
    trace_id: Optional[str] = None,
    generation_name: Optional[str] = None
) -> Awaitable[AsyncIterator[GenerateContentResponse]]
```

Generate content stream.

**Arguments**:

| Name              | Description          |
| ----------------- | -------------------- |
| `model`           | The model to use.    |
| `contents`        | The contents to use. |
| `config`          | The config to use.   |
| `trace_id`        | The trace id.        |
| `generation_name` | The generation name. |

**Returns**:

| Name                                                | Description                   |
| --------------------------------------------------- | ----------------------------- |
| `Awaitable[AsyncIterator[GenerateContentResponse]]` | The response from the models. |

#### generate\_content

```python theme={null}
@override
async def generate_content(
        *,
        model: str,
        contents: Union[ContentListUnion, ContentListUnionDict],
        config: Optional[GenerateContentConfigOrDict] = None,
        trace_id: Optional[str] = None,
        generation_name: Optional[str] = None) -> GenerateContentResponse
```

Generate content.

**Arguments**:

| Name              | Description          |
| ----------------- | -------------------- |
| `model`           | The model to use.    |
| `contents`        | The contents to use. |
| `config`          | The config to use.   |
| `trace_id`        | The trace id.        |
| `generation_name` | The generation name. |

**Returns**:

| Name                      | Description                   |
| ------------------------- | ----------------------------- |
| `GenerateContentResponse` | The response from the models. |

#### \_\_getattr\_\_

```python theme={null}
def __getattr__(name: str) -> Any
```

Get an attribute from the models.

**Arguments**:

| Name   | Description                |
| ------ | -------------------------- |
| `name` | The name of the attribute. |

**Returns**:

| Name  | Description    |
| ----- | -------------- |
| `Any` | The attribute. |

#### \_\_setattr\_\_

```python theme={null}
def __setattr__(name: str, value: Any) -> None
```

Set an attribute on the models.

**Arguments**:

| Name    | Description                 |
| ------- | --------------------------- |
| `name`  | The name of the attribute.  |
| `value` | The value of the attribute. |

## [MaximGeminiAsyncClient](/sdk/python/references/logger/gemini/async_client)

```python theme={null}
class MaximGeminiAsyncClient(AsyncClient)
```

[Maxim](/sdk/python/references/maxim) Gemini async client.

This class represents a maxim gemini async client.

#### \_\_init\_\_

```python theme={null}
def __init__(client: AsyncClient, logger: Logger)
```

Initialize a maxim gemini async client.

**Arguments**:

| Name     | Description |
| -------- | ----------- |
| `client` | The client. |
| `logger` | The logger. |

#### \_\_getattr\_\_

```python theme={null}
def __getattr__(name: str) -> Any
```

Get an attribute from the client.

**Arguments**:

| Name   | Description                |
| ------ | -------------------------- |
| `name` | The name of the attribute. |

**Returns**:

| Name  | Description    |
| ----- | -------------- |
| `Any` | The attribute. |

#### \_\_setattr\_\_

```python theme={null}
def __setattr__(name: str, value: Any) -> None
```

Set an attribute on the client.

**Arguments**:

| Name    | Description                 |
| ------- | --------------------------- |
| `name`  | The name of the attribute.  |
| `value` | The value of the attribute. |
