Инструменты и JSON · UltraGPT API
Инструменты и JSON
Вызов функций и структурированный вывод — в формате OpenAI. Запрос с tools к модели без их поддержки сразу получает 400 unsupported_parameter.
response = client.chat.completions.create(
model="grok-4.7",
messages=[{"role": "user", "content": "Extract: Ada Lovelace, born 1815"}],
response_format={
"type": "json_schema",
"json_schema": {
"name": "person",
"strict": True,
"schema": {
"type": "object",
"properties": {"name": {"type": "string"}, "born": {"type": "integer"}},
"required": ["name", "born"],
"additionalProperties": False,
},
},
},
)