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

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

## OpenAISchemaConverter

```python
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__"></a>

### __init__

```python
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"></a>

### convert

```python
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.
