Skip to content

marvin.utilities.openai

Utilities for working with OpenAI.

get_openai_client

Retrieves an OpenAI client (sync or async) based on the current configuration.

Returns:

Type Description
Union[AsyncClient, Client, AzureOpenAI, AsyncAzureOpenAI]

The OpenAI client

Example

Retrieving an OpenAI client

from marvin.utilities.openai import get_client

client = get_client()