labring / FastGPT

FastGPT is a knowledge-based platform built on the LLMs, offers a comprehensive suite of out-of-the-box capabilities such as data processing, RAG retrieval, and visual AI workflow orchestration, letting you easily develop and deploy complex question-answering systems without the need for extensive setup or configuration.
https://tryfastgpt.ai
Other
17.48k stars 4.69k forks source link

FastGPT is deployed locally, and the problem classification function is not available. #724

Closed RebithNing closed 9 months ago

RebithNing commented 9 months ago

你的版本

问题描述 使用chatGML3-6b模型,使用高级编排的功能时,问题分类不可用,总是返回最后一个指定回复, fastGPT镜像返回 Your model may not support toll_call SyntaxError: Unexpected end of JSON input at JSON.parse () at h (/app/projects/app/.next/server/chunks/80424.js:75:554) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.j [as classifyQuestion] (/app/projects/app/.next/server/chunks/80424.js:70:889) at async Q (/app/projects/app/.next/server/chunks/80424.js:91:6044) at async Promise.all (index 0) at async Promise.all (index 0) at async Promise.all (index 0) at async A (/app/projects/app/.next/server/chunks/80424.js:91:7018) at async l (/app/projects/app/.next/server/pages/api/core/chat/chatTest.js:1:2552) 这个报错 但是模型已经返回了正确的值 2024-01-10 17:51:59.678 | DEBUG | main:create_chat_completion:233 - ==== request ==== {'messages': [ChatMessage(role='user', content='<背景知识>\n你是一个问题分类器,根据提问返回对应的类型的字段。\n</背景知识>\n\n问题: "客户端无法跳转怎么处理?"\n ', name=None, function_call=None)], 'temperature': 0.0, 'top_p': 0.8, 'max_tokens': 1024, 'echo': False, 'stream': False, 'repetition_penalty': 1.1, 'tools': [{'type': 'function', 'function': {'name': 'classify_question', 'description': '根据对话记录及补充的背景知识,对问题进行分类,并返回对应的类型字段', 'parameters': {'type': 'object', 'properties': {'type': {'type': 'string', 'description': "问题类型。下面是几种可选的问题类型: 客户端,返回:'wqre';小程序,返回:'sdfa';浏览器,返回:'agex'", 'enum': ['wqre', 'sdfa', 'agex']}}, 'required': ['type']}}}]} 2024-01-10 17:52:00.607 | DEBUG | main:create_chat_completion:314 - ==== message ==== role='assistant' content="classify_question\n python\ntool_call(type='wqre')\n" name=None function_call=FunctionCallResponse(name='classify_question', arguments='{"type": "wqre"}')

复现步骤

chatglm3-6b直接接入fastgpt

预期结果 正常分类 相关截图

8109ad8ad128ac6ae1977262bdf5355 2502d9d0f840820ed026e49525395e1 d75075b9c9761c56692d0a42f55db41
RebithNing commented 9 months ago

Why is the problem classification feature not open when deployed locally? Why!

nongmo677 commented 9 months ago

结案:你的接口返回的ChatCompletionMessage返回的是function_call,而fastgpt里面是通过tool_calls的参数识别的调用,所以报错了 解决方案:

c121914yu commented 9 months ago

结案:你的接口返回的ChatCompletionMessage返回的是function_call,而fastgpt里面是通过tool_calls的参数识别的调用,所以报错了 解决方案:

  • 改你本地的接口
  • 或者改fastgpt的源码

或者使用 prompt 模式

SnakeHacker commented 8 months ago

结案:你的接口返回的ChatCompletionMessage返回的是function_call,而fastgpt里面是通过tool_calls的参数识别的调用,所以报错了 解决方案:

  • 改你本地的接口
  • 或者改fastgpt的源码

如果不是openAI 的gpt模型 ,在config.local.json配置文件中,把模型配置的 toolChoice字段置为false就行了,因为gpt-3.5-turbo默认toolChoice设置为True,所以会调用相关代码,非GPT模型调用就会报错。

image

katfionn commented 6 months ago

结案:你的接口返回的ChatCompletionMessage返回的是function_call,而fastgpt里面是通过tool_calls的参数识别的调用,所以报错了 解决方案:

  • 改你本地的接口
  • 或者改fastgpt的源码

如果不是openAI 的gpt模型 ,在config.local.json配置文件中,把模型配置的 toolChoice字段置为false就行了,因为gpt-3.5-turbo默认toolChoice设置为True,所以会调用相关代码,非GPT模型调用就会报错。

image

大佬,这个文件的路径在哪,我早容器里面找到/app/projects/app/src这个路径后,里面没看到service的文件夹,和你上图的长得不一样

xxexplorer commented 4 months ago

遇到一样的问题,请问您解决了吗?