search2ai icon indicating copy to clipboard operation
search2ai copied to clipboard

一定要支持 function calling吗?

Open dominikusacom opened this issue 1 year ago • 3 comments

huggingface的Qwen2.5或llama-3.2-11B好像不支持。 是不是可以询问时先跑搜索,然后把答案包在 role: "system" 一起给后面API。 或是多跑一圈让一个API负责转换成关键字搜索,另一个API让他复述答案。

dominikusacom avatar Oct 19 '24 14:10 dominikusacom

不支持 function calling 的模型,硬要实现的话,效果会很不稳定,没法用。另外, huggingface 里也有很多模型支持 function calling

dominikusacom @.***>于2024年10月19日 周六22:13写道:

huggingface好像不支持。 是不是可以询问时先跑搜索,然后把答案包在 role: "system" 一起给后面API。 或是多跑一圈让一个API负责转换成关键字搜索,另一个API让他复述答案。

— Reply to this email directly, view it on GitHub https://github.com/fatwang2/search2ai/issues/39, or unsubscribe https://github.com/notifications/unsubscribe-auth/A77NZSXUSYGZTYMJAYMBCFDZ4JSI5AVCNFSM6AAAAABQHQXQGSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGU4TSMRSGU4TANY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

fatwang2 avatar Oct 19 '24 14:10 fatwang2

这种方法能替代function calling吗? https://www.cnblogs.com/mingupupu/p/18385798

dominikusacom avatar Oct 19 '24 14:10 dominikusacom

结果我发现Qwen是支持function calling的,应该说所有huggingface的inference API都支持。 https://huggingface.co/docs/api-inference/tasks/chat-completion?code=curl

tools | object[] | (A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for.) function* | object |   arguments* | unknown |   description | string |   name* | string |   type* | string

只要用上抱抱脸的tools,经过Search2ai的会话就会Internal Server Error, 但如果事前过滤掉tools,Search2ai又会话正常只是没有联网,不知道tools为何会卡住huggingface。 换了huggingface其他模型也一样...

请求处理时发生错误: SyntaxError: "[object Object]" is not valid JSON

{ role: 'user', content: '你好' }, at JSON.parse () at handleRequest (/src/api/search2ai.js:143:39) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async module.exports (/src/api/index.js:87:24) at async /src/api/index.js:145:13 { role: 'assistant', tool_calls: [ [Object] ] } ]

dominikusacom avatar Oct 19 '24 22:10 dominikusacom