wrap_openai#

langsmith.wrappers._openai.wrap_openai(client: C, *, tracing_extra: TracingExtra | None = None, chat_name: str = 'ChatOpenAI', completions_name: str = 'OpenAI') C[source]#

Patch the OpenAI client to make it traceable.

Parameters:
  • client (Union[OpenAI, AsyncOpenAI]) – The client to patch.

  • tracing_extra (Optional[TracingExtra], optional) – Extra tracing information. Defaults to None.

  • chat_name (str, optional) – The run name for the chat completions endpoint. Defaults to “ChatOpenAI”.

  • completions_name (str, optional) – The run name for the completions endpoint. Defaults to “OpenAI”.

Returns:

The patched client.

Return type:

Union[OpenAI, AsyncOpenAI]