API interface to get the next round of problem suggestions, the interface sometimes returns a different structure #5811

Closed
opened 2026-02-21 18:12:41 -05:00 by yindo · 3 comments
Owner

Originally created by @1192603654 on GitHub (Sep 26, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.8.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

The JSON structure may appear when the actual call is made

1727339198788

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @1192603654 on GitHub (Sep 26, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.8.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![image](https://github.com/user-attachments/assets/90ea1c3f-9825-4b55-97ec-f53fd285b1b1) The JSON structure may appear when the actual call is made ![1727339198788](https://github.com/user-attachments/assets/0cf5ae44-b43a-4892-afa1-b90e30f7e6ac) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 18:12:41 -05:00
yindo closed this issue 2026-02-21 18:12:41 -05:00
Author
Owner

@crazywoola commented on GitHub (Sep 26, 2024):

It depends on what llm you choose.

@crazywoola commented on GitHub (Sep 26, 2024): It depends on what llm you choose.
Author
Owner

@dosubot[bot] commented on GitHub (Sep 26, 2024):

Hey @1192603654! 👋 I'm here to help you with any bugs, questions, or contributions you have in mind. I'm Dosu, a bot designed to assist you while you wait for a human maintainer.

I found a similar issue that was previously discussed and closed. The issue was about the get_suggested_questions_after_answer function returning a different data structure. The discrepancy was due to the function's design in Dify version 0.6.7, where it returns an array of objects with a "question" key instead of a simple array of strings. This design allows for handling rich metadata associated with each question [1].

Additionally, the API interface for getting the next round of problem suggestions sometimes returns a different JSON structure because the JSON Schema output must be enabled and properly configured in the application settings. If the JSON Schema is not enabled or the schema template is not correctly defined, the output structure may vary. To ensure consistent JSON structure, follow these steps:

  1. Switch the LLM to a model that supports JSON Schema output.
  2. Enable JSON Schema in the settings form.
  3. Input the correct JSON Schema template.
  4. Set the response_format to json_schema.

Here is an example of a JSON Schema template:

{
    "name": "template_schema",
    "description": "JSON Schemaの汎用テンプレート",
    "strict": true,
    "schema": {
        "type": "object",
        "properties": {
            "field1": {
                "type": "string",
                "description": "field1の説明"
            },
            "field2": {
                "type": "number",
                "description": "field2の説明"
            },
            "field3": {
                "type": "array",
                "description": "field3の説明",
                "items": {
                    "type": "string"
                }
            },
            "field4": {
                "type": "object",
                "description": "field4の説明",
                "properties": {
                    "subfield1": {
                        "type": "string",
                        "description": "subfield1の説明"
                    }
                },
                "required": ["subfield1"],
                "additionalProperties": false
            }
        },
        "required": ["field1", "field2", "field3", "field4"],
        "additionalProperties": false
    }
}

Ensure that the JSON Schema is correctly defined and applied to maintain a consistent JSON structure in the API responses [2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 26, 2024): <!-- Greeting --> Hey @1192603654! 👋 I'm here to help you with any bugs, questions, or contributions you have in mind. I'm Dosu, a bot designed to assist you while you wait for a human maintainer. <!-- Answer --> I found a similar issue that was previously discussed and closed. The issue was about the `get_suggested_questions_after_answer` function returning a different data structure. The discrepancy was due to the function's design in Dify version 0.6.7, where it returns an array of objects with a "question" key instead of a simple array of strings. This design allows for handling rich metadata associated with each question <sup>[[1]](https://github.com/langgenius/dify/issues/4291)</sup>. Additionally, the API interface for getting the next round of problem suggestions sometimes returns a different JSON structure because the JSON Schema output must be enabled and properly configured in the application settings. If the JSON Schema is not enabled or the schema template is not correctly defined, the output structure may vary. To ensure consistent JSON structure, follow these steps: 1. Switch the LLM to a model that supports JSON Schema output. 2. Enable `JSON Schema` in the settings form. 3. Input the correct JSON Schema template. 4. Set the `response_format` to `json_schema`. Here is an example of a JSON Schema template: ```json { "name": "template_schema", "description": "JSON Schemaの汎用テンプレート", "strict": true, "schema": { "type": "object", "properties": { "field1": { "type": "string", "description": "field1の説明" }, "field2": { "type": "number", "description": "field2の説明" }, "field3": { "type": "array", "description": "field3の説明", "items": { "type": "string" } }, "field4": { "type": "object", "description": "field4の説明", "properties": { "subfield1": { "type": "string", "description": "subfield1の説明" } }, "required": ["subfield1"], "additionalProperties": false } }, "required": ["field1", "field2", "field3", "field4"], "additionalProperties": false } } ``` Ensure that the JSON Schema is correctly defined and applied to maintain a consistent JSON structure in the API responses <sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/jp/learn-more/how-to-use-json-schema-in-dify.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@1192603654 commented on GitHub (Sep 27, 2024):

image
It uses workflow orchestration, ChatGPT-4O's LLM

@1192603654 commented on GitHub (Sep 27, 2024): ![image](https://github.com/user-attachments/assets/575408f1-bc17-4748-83de-1a2351266cd5) It uses workflow orchestration, ChatGPT-4O's LLM
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5811