Skip to main content

wrapOpenAI

weaveDocs


weave / wrapOpenAI

Function: wrapOpenAI()

wrapOpenAI<T>(openai): T

Wraps the OpenAI API to enable function tracing for OpenAI calls.

Type Parameters

T extends OpenAIAPI

Parameters

openai: T

Returns

T

Example

const openai = wrapOpenAI(new OpenAI());
const result = await openai.chat.completions.create({
model: 'gpt-3.5-turbo',
messages: [{ role: 'user', content: 'Hello, world!' }]
});

Defined in

integrations/openai.ts:159