Closed 1192603654 closed 1 month ago
It depends on what llm you choose.
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:
JSON Schema
in the settings form.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.
It uses workflow orchestration, ChatGPT-4O's LLM
Self Checks
Dify version
0.8.3
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
The JSON structure may appear when the actual call is made
✔️ Expected Behavior
No response
❌ Actual Behavior
No response