# convert_prompt_to_openai_format

> **Function** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/client/convert_prompt_to_openai_format)

Convert a prompt to OpenAI format.

Requires the `langchain_openai` package to be installed.

## Signature

```python
convert_prompt_to_openai_format(
    messages: Any,
    model_kwargs: Optional[dict[str, Any]] = None,
) -> dict
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `messages` | `Any` | Yes | The messages to convert. |
| `model_kwargs` | `Optional[Dict[str, Any]]` | No | Model configuration arguments including `stop` and any other required arguments. (default: `None`) |

## Returns

`dict`

The prompt in OpenAI format.

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/791701a304a72495d108669ef11c194983fd0e95/python/langsmith/client.py#L10237)