InferenceCapabilities

JSON output

How to get a reply from the model strictly in JSON format, so that a program can parse it without any extra text.

JSON output is for cases where the result of the model's work is read by a program rather than a person: for example, you ask it to split an address into parts. Without this mode the model may add explanations to the JSON, which makes the reply harder to parse. The mode is turned on with the response_format parameter.

Request

JSON
{
  "model": "yenisei-100",
  "messages": [
    {"role": "system", "content": "Reply with JSON only."},
    {"role": "user", "content": "Parse the address: Krasnoyarsk, Mira Avenue, 10"}
  ],
  "response_format": { "type": "json_object" }
}

Response

The reply content in choices[].message.content will be a string containing JSON. All you have to do is parse it.

Tell the model in the request which fields you need. The mode guarantees that the reply can be parsed as JSON, but it does not guess your schema.