Skip to content

OpenAI

Use Chronary’s calendar tools with the OpenAI SDK’s function calling. createChronaryOpenAIToolkit returns tool definitions in the chat.completions tools format.

Terminal window
npm install @chronary/toolkit @chronary/sdk openai
import OpenAI from 'openai';
import { createChronaryOpenAIToolkit } from '@chronary/toolkit/openai';
const tools = createChronaryOpenAIToolkit({
apiKey: process.env.CHRONARY_API_KEY!,
});
const client = new OpenAI();
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'When is my next calendar event?' }],
tools,
});
console.log(response.choices[0].message.tool_calls);