> ## 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.Client

> Gemini client implementation for API interactions and model integration.

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

## [MaximGeminiChatSession](/sdk/python/references/logger/gemini/client)

```python theme={null}
class MaximGeminiChatSession(Chat)
```

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

This class represents a [Maxim](/sdk/python/references/maxim) wrapped Gemini chat session.

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

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

Initialize a [Maxim](/sdk/python/references/maxim) wrapped Gemini 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
def send_message(
        message: Union[list[PartUnionDict], PartUnionDict],
        generation_name: Optional[str] = None) -> GenerateContentResponse
```

Send a message to the [Maxim](/sdk/python/references/maxim) wrapped Gemini chat session.

**Arguments**:

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

**Returns**:

| Name                      | Description                                                                              |
| ------------------------- | ---------------------------------------------------------------------------------------- |
| `GenerateContentResponse` | The response from the [Maxim](/sdk/python/references/maxim) wrapped Gemini chat session. |

#### send\_message\_stream

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

Send a message to the [Maxim](/sdk/python/references/maxim) wrapped Gemini chat session stream.

**Arguments**:

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

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

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

Get an attribute from the chat session.

**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 session.

**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 of the chat session.

This method will end the trace of the chat session if the trace id is not None and the trace is local.

## [MaximGeminiChats](/sdk/python/references/logger/gemini/client)

```python theme={null}
class MaximGeminiChats(Chats)
```

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

This class represents a [Maxim](/sdk/python/references/maxim) wrapped Gemini chats.

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

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

Initialize a [Maxim](/sdk/python/references/maxim) wrapped Gemini chats.

**Arguments**:

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

#### create

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

Create a [Maxim](/sdk/python/references/maxim) wrapped Gemini 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.       |
| `session_id` | The session id.     |

**Returns**:

| Name   | Description                                                            |
| ------ | ---------------------------------------------------------------------- |
| `Chat` | The [Maxim](/sdk/python/references/maxim) wrapped Gemini 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. |

## [MaximGeminiModels](/sdk/python/references/logger/gemini/client)

```python theme={null}
class MaximGeminiModels(Models)
```

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

This class represents a [Maxim](/sdk/python/references/maxim) wrapped Gemini models.

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

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

Initialize a [Maxim](/sdk/python/references/maxim) wrapped Gemini models.

**Arguments**:

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

#### generate\_content\_stream

```python theme={null}
@override
def generate_content_stream(
    *,
    model: str,
    contents: Union[ContentListUnion, ContentListUnionDict],
    config: Optional[GenerateContentConfigOrDict] = None,
    trace_id: Optional[str] = None,
    generation_name: Optional[str] = None
) -> Iterator[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         |
| ----------------------------------- | ------------------- |
| `Iterator[GenerateContentResponse]` | The content stream. |

#### generate\_content

```python theme={null}
@override
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 content. |

#### \_\_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. |

## [MaximGeminiClient](/sdk/python/references/logger/gemini/client)

```python theme={null}
class MaximGeminiClient(Client)
```

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

This class represents a [Maxim](/sdk/python/references/maxim) wrapped Gemini client.

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

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

Initialize a [Maxim](/sdk/python/references/maxim) wrapped Gemini client.

**Arguments**:

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

#### chats

```python theme={null}
@property
def chats() -> MaximGeminiChats
```

Get the [Maxim](/sdk/python/references/maxim) wrapped Gemini chats.

**Returns**:

| Name                                                              | Description                                                     |
| ----------------------------------------------------------------- | --------------------------------------------------------------- |
| `[MaximGeminiChats](/sdk/python/references/logger/gemini/client)` | The [Maxim](/sdk/python/references/maxim) wrapped Gemini chats. |

#### aio

```python theme={null}
@property
def aio() -> MaximGeminiAsyncClient
```

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

**Returns**:

| Name                                                                          | Description                                                            |
| ----------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| `[MaximGeminiAsyncClient](/sdk/python/references/logger/gemini/async_client)` | The [Maxim](/sdk/python/references/maxim) wrapped Gemini async client. |

#### models

```python theme={null}
@property
def models() -> MaximGeminiModels
```

Get the [Maxim](/sdk/python/references/maxim) wrapped Gemini models.

**Returns**:

| Name                                                               | Description                                                      |
| ------------------------------------------------------------------ | ---------------------------------------------------------------- |
| `[MaximGeminiModels](/sdk/python/references/logger/gemini/client)` | The [Maxim](/sdk/python/references/maxim) wrapped Gemini models. |

#### \_\_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. |
