Closed codingl2k1 closed 1 week ago
If the returned value is not json, then the tool call must have failed. It is impossible to return normal content. Therefore, under normal logic, this place must be a json, otherwise it will not be able to execute later.
If the returned value is not json, then the tool call must have failed. It is impossible to return normal content. Therefore, under normal logic, this place must be a json, otherwise it will not be able to execute later.
The model may generate a prompt for the user. e.g. there is a tool matching the request, however, it requires more information to call it.
Is it possible that the output stream is not completed. Then it decodes json failed.
You are right, this code has been deprecated. In all GLM-4 demos, you only need to use the generate function provided by transformers. These codes are left over from the early GLM-3 Demo. We will delete some of the codes. Sorry.
You are right, this code has been deprecated. In all GLM-4 demos, you only need to use the generate function provided by transformers. These codes are left over from the early GLM-3 Demo. We will delete some of the codes. Sorry.
Got it. Thank you.
System Info / 系統信息
Transformers 4.41.2 Use the latest THUDM/glm-4-9b-chat from huggingface
Who can help? / 谁可以帮助到您?
The generated content may not be a valid json:![image](https://github.com/THUDM/GLM-4/assets/138426806/e736abc2-4372-49f0-bca0-f6079ff7eddc)
Information / 问题信息
Reproduction / 复现过程
Passing tools to the stream_chat API, if the generated arg string is not a valid json, it may raises the json.decoder.JSONDecodeError
Expected behavior / 期待表现
If the generated output can't be parsed as a json, return a plain text instead.