wrapOpenAI
weave • Docs
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!' }]
});