Uploaded image for project: 'Qt Design Studio'
  1. Qt Design Studio
  2. QDS-15906

Use a json schema for AI responses

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: Not Evaluated Not Evaluated
    • None
    • None
    • AI Assistant
    • None

      Lots of models support json schema.

      It can be defined to get a structured result from AI.

      Here's a tested schema:

       

      {
          "json_schema": {
              "name": "QtDesignStudioAiResponse",
              "schema": {
                  "type": "object",
                  "properties": {
                      "qml": {
                          "description": "Generated Qml",
                          "type": "string"
                      },
                      "selectedNodes": {
                          "description": "ID of the selected nodes",
                          "type": "array",
                          "items": {
                              "type": "string"
                          }
                      },
                      "textMessage": {
                          "description": "Text explanation",
                          "type": "string"
                      }
                  },
                  "required": [],
                  "additionalProperties": false
              }
          },
          "type": "json_schema"
      } 

      This works on the following models:

       

      • meta-llama/llama-4-maverick-17b-128e-instruct
      • openai/gpt-oss-120b
      • openai/gpt-oss-20b
      • gpt-4o-mini

      The benefit is that the API respects the schema, and we shouldn't be concerned about the response structure. Also, we shouldn't define it in the manifests, and it prevents confusion.

        For Gerrit Dashboard: QDS-15906
        # Subject Branch Project Status CR V

            ali.kianian Ali Kianian
            ali.kianian Ali Kianian
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change