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

# Container

> Container utilities for data models and type definitions used throughout the maxim sdk.

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

Models for LangChain logging and tracing functionality.

This module contains data models used for tracking and logging LangChain operations,
including metadata storage and run information.

## [Metadata](/sdk/python/references/models/metadata)

```python theme={null}
@dataclass
class Metadata()
```

RunMetadata class to holds the metadata info associated with a run

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

```python theme={null}
def __init__(metadata: Optional[Dict[str, Any]])
```

Initializes the RunMetadata object

**Arguments**:

| Name       | Type                        | Description                                                           |
| ---------- | --------------------------- | --------------------------------------------------------------------- |
| `metadata` | *Optional\[Dict\[str,Any]]* | [Metadata](/sdk/python/references/models/metadata) to initialize from |

## [Container](/sdk/python/references/logger/models/container)

```python theme={null}
class Container()
```

[Container](/sdk/python/references/logger/models/container) class to hold the container id, type and name for logging

#### create

```python theme={null}
def create(tags: Optional[Dict[str, str]] = None) -> None
```

Creates the container in the logger

#### id

```python theme={null}
def id() -> str
```

**Returns**:

| Name  | Description         |
| ----- | ------------------- |
| `str` | id of the container |

#### type

```python theme={null}
def type() -> str
```

**Returns**:

| Name  | Description           |
| ----- | --------------------- |
| `str` | type of the container |

#### is\_created

```python theme={null}
def is_created() -> bool
```

Checks if the container has been created

**Returns**:

| Name   | Description                                             |
| ------ | ------------------------------------------------------- |
| `bool` | True if the container has been created, False otherwise |

#### parent

```python theme={null}
def parent() -> Optional[str]
```

**Returns**:

| Name                                                          | Description      |
| ------------------------------------------------------------- | ---------------- |
| `[Container](/sdk/python/references/logger/models/container)` | parent container |

#### add\_generation

```python theme={null}
@abstractmethod
def add_generation(config: GenerationConfig) -> Generation
```

Adds a generation to the container

**Returns**:

| Name                                                                | Description       |
| ------------------------------------------------------------------- | ----------------- |
| `[Generation](/sdk/python/references/logger/components/generation)` | Generation object |

#### add\_tool\_call

```python theme={null}
@abstractmethod
def add_tool_call(config: ToolCallConfig) -> ToolCall
```

Adds a tool call to the container

**Returns**:

| Name                                               | Description     |
| -------------------------------------------------- | --------------- |
| `[ToolCall](/sdk/python/references/models/prompt)` | ToolCall object |

#### add\_event

```python theme={null}
def add_event(event_id: str,
              name: str,
              tags: Dict[str, str],
              metadata: Optional[Dict[str, Any]] = None) -> None
```

Adds an event to the container.

**Arguments**:

| Name       | Type              | Description                                             |
| ---------- | ----------------- | ------------------------------------------------------- |
| `event_id` | *str*             | Unique identifier for the event.                        |
| `name`     | *str*             | Name of the event.                                      |
| `tags`     | *Dict\[str, str]* | Additional key-value pairs to associate with the event. |

**Returns**:

None

#### add\_span

```python theme={null}
@abstractmethod
def add_span(config: SpanConfig) -> Span
```

Adds a span to the container

**Returns**:

| Name                                                    | Description |
| ------------------------------------------------------- | ----------- |
| `[Span](/sdk/python/references/logger/components/span)` | Span object |

#### add\_retrieval

```python theme={null}
@abstractmethod
def add_retrieval(config: RetrievalConfig) -> Retrieval
```

Adds a retrieval to the container

**Returns**:

| Name                                                              | Description      |
| ----------------------------------------------------------------- | ---------------- |
| `[Retrieval](/sdk/python/references/logger/components/retrieval)` | Retrieval object |

#### add\_tags

```python theme={null}
def add_tags(tags: Dict[str, str]) -> None
```

Adds tags to the container

**Arguments**:

| Name   | Type                        | Description |
| ------ | --------------------------- | ----------- |
| `tags` | *Optional\[Dict\[str,str]]* | Tags to add |

#### add\_error

```python theme={null}
def add_error(error: ErrorConfig) -> None
```

Adds an error to the container

**Arguments**:

| Name    | Type                                                                | Description                                          |
| ------- | ------------------------------------------------------------------- | ---------------------------------------------------- |
| `error` | *[GenerationError](/sdk/python/references/logger/components/types)* | [Error](/sdk/python/references/models/prompt) to add |

#### set\_input

```python theme={null}
def set_input(input: str) -> None
```

Sets the input to the container

**Arguments**:

| Name    | Type  | Description  |
| ------- | ----- | ------------ |
| `input` | *str* | Input to set |

#### set\_output

```python theme={null}
def set_output(output) -> None
```

Sets the output to the container

**Arguments**:

| Name     | Type  | Description   |
| -------- | ----- | ------------- |
| `output` | *str* | Output to set |

#### add\_metadata

```python theme={null}
def add_metadata(metadata: Dict[str, str]) -> None
```

Adds metadata to the container

**Arguments**:

| Name       | Type                        | Description                                               |
| ---------- | --------------------------- | --------------------------------------------------------- |
| `metadata` | *Optional\[Dict\[str,str]]* | [Metadata](/sdk/python/references/models/metadata) to add |

#### end

```python theme={null}
def end() -> None
```

Ends the container

## [TraceContainer](/sdk/python/references/logger/models/container)

```python theme={null}
class TraceContainer(Container)
```

A trace in the logger

#### add\_generation

```python theme={null}
def add_generation(config: GenerationConfig) -> Generation
```

Adds a generation to the container

**Returns**:

| Name                                                                | Description       |
| ------------------------------------------------------------------- | ----------------- |
| `[Generation](/sdk/python/references/logger/components/generation)` | Generation object |

#### end

```python theme={null}
def end() -> None
```

Ends the container

## [SpanContainer](/sdk/python/references/logger/models/container)

```python theme={null}
class SpanContainer(Container)
```

A span in the logger

#### end

```python theme={null}
def end() -> None
```

Ends the container
