from openai import OpenAI
client = OpenAI(
base_url="https://api.naga.ac/v1",
api_key="YOUR_API_KEY",
)
response = client.responses.create(
model="gpt-4.1",
input="Extract the event details from: Alice and Bob are going to a science fair on Friday.",
text={
"format": {
"type": "json_schema",
"name": "calendar_event",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"date": {"type": "string"},
"participants": {
"type": "array",
"items": {"type": "string"},
},
},
"required": ["name", "date", "participants"],
"additionalProperties": False,
},
"strict": True,
}
},
)
print(response.output_text)