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

# Camel.models. utils

<a id="camel.models._utils" />

<a id="camel.models._utils.try_modify_message_with_format" />

## try\_modify\_message\_with\_format

```python theme={"system"}
def try_modify_message_with_format(
    message: OpenAIMessage,
    response_format: Optional[Type[BaseModel]]
):
```

Modifies the content of the message to include the instruction of using
the response format.

The message will not be modified in the following cases:

* response\_format is None
* message content is not a string
* message role is assistant

**Parameters:**

* **response\_format** (Optional\[Type\[BaseModel]]): The Pydantic model class.
* **message** (OpenAIMessage): The message to be modified.
