Skip to main content

Function: wrapOpenAI()

Defined in: src/handlers/openai/index.ts Wraps an OpenAI instance with logging.

Type Parameters

T

T extends OpenAIType

Parameters

openAIClient

T The OpenAI instance to wrap.

logger?

GalileoLogger The logger to use. Defaults to a new GalileoLogger instance.

ingestionHook?

(request: LogTracesIngestRequest) => void | Promise<void> Optional async callback invoked with the trace ingest request payload before sending to the Galileo API. Use this to inspect or modify trace data before ingestion. When provided without a logger, a new GalileoLogger is created with this hook and traces are automatically flushed to the hook after each completed call. No explicit flush() is needed.

Returns

T The wrapped OpenAI instance. Usage: