What is the local API format for ChatGLM responses? #6274

Closed
opened 2026-02-21 18:14:50 -05:00 by yindo · 5 comments
Owner

Originally created by @sichehu on GitHub (Oct 23, 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.7.3

Cloud or Self Hosted

Cloud

Steps to reproduce

image

The localized deployment of the ChatGLM model can receive diverse inputs, but the responses returned are always in the wrong format. Is there any documentation for reference?

✔️ Expected Behavior

normal

Actual Behavior

it is none

Originally created by @sichehu on GitHub (Oct 23, 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.7.3 ### Cloud or Self Hosted Cloud ### Steps to reproduce ![image](https://github.com/user-attachments/assets/73f4d563-3392-4bda-945c-3b3ce4d6afef) The localized deployment of the ChatGLM model can receive diverse inputs, but the responses returned are always in the wrong format. Is there any documentation for reference? ### ✔️ Expected Behavior normal ### ❌ Actual Behavior it is none
yindo added the 🙋‍♂️ question🌚 invalid🤔 cant-reproduce labels 2026-02-21 18:14:50 -05:00
yindo closed this issue 2026-02-21 18:14:50 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 23, 2024):

I couldn't find specific information about the local API format for ChatGLM responses in the Dify documentation. However, there is a configuration setting in Dify that affects the response format of ChatGLM models. The return_type parameter controls the type of content returned. If this field is empty or not specified, the response defaults to json_string, which returns a standard JSON string. Alternatively, setting it to text will return the original text content [1].

Additionally, Dify supports JSON Schema output for certain models, allowing for structured responses. To enable this, switch the LLM in your application to a model that supports JSON Schema output, such as gpt-4o-mini-2024-07-18 or later versions. In the settings form, enable JSON Schema and fill in the JSON Schema template. You can also enable the response_format column and switch it to the json_schema format to ensure the LLM outputs content in a structured format according to the JSON Schema definitions [2].

If you're experiencing issues with response formats, you might want to check these settings to ensure they are configured correctly.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 23, 2024): <!-- Answer --> I couldn't find specific information about the local API format for ChatGLM responses in the Dify documentation. However, there is a configuration setting in Dify that affects the response format of ChatGLM models. The `return_type` parameter controls the type of content returned. If this field is empty or not specified, the response defaults to `json_string`, which returns a standard JSON string. Alternatively, setting it to `text` will return the original text content <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/zhipuai/llm/chatglm_turbo.yaml)</sup>. Additionally, Dify supports JSON Schema output for certain models, allowing for structured responses. To enable this, switch the LLM in your application to a model that supports JSON Schema output, such as `gpt-4o-mini-2024-07-18` or later versions. In the settings form, enable `JSON Schema` and fill in the JSON Schema template. You can also enable the `response_format` column and switch it to the `json_schema` format to ensure the LLM outputs content in a structured format according to the JSON Schema definitions <sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/en/learn-more/how-to-use-json-schema-in-dify.md)</sup>. If you're experiencing issues with response formats, you might want to check these settings to ensure they are configured correctly. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Oct 23, 2024):

Please provide the correct version information.

@crazywoola commented on GitHub (Oct 23, 2024): Please provide the correct version information.
Author
Owner

@sichehu commented on GitHub (Oct 23, 2024):

the dify version is 0.7.3
image

请提供正确的版本信息。

@sichehu commented on GitHub (Oct 23, 2024): the dify version is 0.7.3 ![image](https://github.com/user-attachments/assets/4ae7f021-81d5-4917-bcf4-9821237bef16) > 请提供正确的版本信息。
Author
Owner

@sichehu commented on GitHub (Oct 23, 2024):

请提供正确的版本信息。
Could you provide me with the default response interface format for ChatGLM2-6B? I use it but it is wrong.
{
"response": "你好!我是人工智能助手 ChatGLM2-6B,很高兴见到你,欢迎问我任何问题。",
"history": [
["你好", "你好!我是人工智能助手 ChatGLM2-6B,很高兴见到你,欢迎问我任何问题。"]
],
"status": 200,
"time": "2024-01-26 16:20:04"
}

@sichehu commented on GitHub (Oct 23, 2024): > 请提供正确的版本信息。 Could you provide me with the default response interface format for ChatGLM2-6B? I use it but it is wrong. { "response": "你好!我是人工智能助手 ChatGLM2-6B,很高兴见到你,欢迎问我任何问题。", "history": [ ["你好", "你好!我是人工智能助手 ChatGLM2-6B,很高兴见到你,欢迎问我任何问题。"] ], "status": 200, "time": "2024-01-26 16:20:04" }
Author
Owner

@crazywoola commented on GitHub (Oct 23, 2024):

Please upgrade to the latest version.

@crazywoola commented on GitHub (Oct 23, 2024): Please upgrade to the latest version.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6274