> ## 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.schemas.openai converter

<a id="camel.schemas.openai_converter" />

<a id="camel.schemas.openai_converter.OpenAISchemaConverter" />

## OpenAISchemaConverter

```python theme={"system"}
class OpenAISchemaConverter(BaseConverter):
```

OpenAISchemaConverter is a class that converts a string or a function
into a BaseModel schema.

**Parameters:**

* **model\_type** (ModelType, optional): The model type to be used. (default: ModelType.GPT\_4O\_MINI)
* **model\_config\_dict** (Optional\[Dict\[str, Any]], optional): A dictionary that will be fed into:obj:`openai.ChatCompletion.create()`. If :obj:`None`, :obj:`ChatGPTConfig().as_dict()` will be used. (default: :obj:`None`)
* **api\_key** (Optional\[str], optional): The API key for authenticating with the OpenAI service. (default: :obj:`None`)
* **output\_schema** (Optional\[Type\[BaseModel]], optional): The expected format of the response. (default: :obj:`None`)
* **prompt** (Optional\[str], optional): The prompt to be used. (default: :obj:`None`)

<a id="camel.schemas.openai_converter.OpenAISchemaConverter.__init__" />

### **init**

```python theme={"system"}
def __init__(
    self,
    model_type: ModelType = ModelType.GPT_4O_MINI,
    model_config_dict: Optional[Dict[str, Any]] = None,
    api_key: Optional[str] = None
):
```

<a id="camel.schemas.openai_converter.OpenAISchemaConverter.convert" />

### convert

```python theme={"system"}
def convert(
    self,
    content: str,
    output_schema: Union[Type[BaseModel], str, Callable],
    prompt: Optional[str] = DEFAULT_CONVERTER_PROMPTS
):
```

Formats the input content into the expected BaseModel

**Parameters:**

* **content** (str): The content to be formatted.
* **output\_schema** (Union\[Type\[BaseModel], str, Callable]): The expected format of the response.

**Returns:**

BaseModel: The formatted response.
