Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一定要支持 function calling吗? #39

Open
dominikusacom opened this issue Oct 19, 2024 · 3 comments
Open

一定要支持 function calling吗? #39

dominikusacom opened this issue Oct 19, 2024 · 3 comments

Comments

@dominikusacom
Copy link

dominikusacom commented Oct 19, 2024

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

@fatwang2
Copy link
Owner

fatwang2 commented Oct 19, 2024 via email

@dominikusacom
Copy link
Author

dominikusacom commented Oct 19, 2024

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

@dominikusacom
Copy link
Author

dominikusacom commented Oct 19, 2024

结果我发现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] ] }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants