import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.naga.ac/v1',
apiKey: 'YOUR_API_KEY',
});
const completion = await client.chat.completions.create({
model: 'gpt-4.1',
messages: [
{
role: 'user',
content: 'Extract the event information.',
},
],
response_format: {
type: 'json_schema',
json_schema: {
name: 'event',
schema: {
type: 'object',
properties: {
name: { type: 'string' },
date: { type: 'string' },
},
required: ['name', 'date'],
additionalProperties: false,
},
strict: true,
},
},
});
console.log(completion.choices[0].message.content);