> ## 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.agentchat.group.context_str.ContextStr

<h2 id="autogen.agentchat.group.context_str.ContextStr" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

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

```python theme={null}
ContextStr(**data: Any)
```

A string that requires context variable substitution.<br />Use the format method to substitute context variables into the string.<br />Create a new model by parsing and validating input data from keyword arguments.<br />Raises \[`ValidationError`]\[pydantic\_core.ValidationError] if the input data cannot be
validated to form a valid model.<br />`self` is explicitly positional-only to allow `self` as a field name.

<b>Parameters:</b>

| Name     | Description   |
| -------- | ------------- |
| `**data` | **Type:** Any |

### Class Attributes

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

#### model\_config

<br />

<br />

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

#### template

<br />

<br />

### Instance Methods

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

#### format

```python theme={null}
format(self, context_variables: ContextVariables) -> str | None
```

Substitute context variables into the string.<br />

<b>Parameters:</b>

| Name                | Description                                                                                                                                                                  |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `context_variables` | The context variables to substitute into the string.<br /><br />**Type:** [ContextVariables](/docs/api-reference/autogen/agentchat/group/context_variables/ContextVariables) |

<b>Returns:</b>

| Type        | Description                                                              |
| ----------- | ------------------------------------------------------------------------ |
| str \| None | Optional\[str]: The formatted string with context variables substituted. |

<br />
