Json Mode x Schema Json Validation

Hi folks,
Does JsonMode ONLY prevent syntax errors or does it encompass syntax errors and errors in compliance with the Schema defined in the function?
This functionality guarantees that in the example below, the “location” and “unit” parameters, in addition to appearing in the response, WILL COME WITH NON-EMPTY VALUES? that is, will the model be able to NOT RETURN ME ZERO DATA for this Schema?

IMPORTANT:
I know that there is a note from OpenAi that there may be hallucinations, but it is not clear whether the hallucination is in relation ONLY to the generated value (because with JSON Mode it guarantees that the data will not be empty) or

CAN WE CONSIDER IT AS A HALLUCINATION the fact that the parameter comes with zero data?

If anyone could clarify I would be grateful!

Example:

 {
      "type": "function",
      "function": {
        "name": "get_current_weather",
        "description": "Get the current weather in a given location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            },
            "unit": {
              "type": "string",
              "enum": ["celsius", "fahrenheit"]
            }
          },
          "required": ["location", "unit"]
        }
      }
    }

The model itself only “guarantees” the validity of JSON. For the parameters validation you can use Instructor or Pydantic directly.

1 Like