Skip to content

Commit 078452b

Browse files
committed
function-calling
1 parent a098d30 commit 078452b

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed
52.5 KB
Loading
156 KB
Loading

use/function-calling.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# 关于函数调用(Function-calling)
2+
3+
又名 Tool Use 等。
4+
5+
这个是目前大部分大模型都有的功能,旨在提供大模型一种调用外部工具的能力,以此实现 Agentic 的一些功能。
6+
7+
比如,问大模型:帮我搜索一下关于“猫”的信息,大模型就会调用用于搜索的外部工具,比如搜索引擎,然后返回搜索结果。
8+
9+
目前,支持的模型包括但不限于
10+
11+
- gpt-4 系列(效果最好)
12+
- gemini 1.5 系列(效果最好)
13+
- gemini 2.0 系列(不包含 thinking 类的模型)(效果最好)
14+
- deepseek v3(deepseek-chat)
15+
- llama3 系列(本地部署参数量较小时效果不好)
16+
17+
等等。
18+
19+
不支持的模型比较常见的有 deepseek-r1, gemini 2.0 的 thinking 类模型等。
20+
21+
在 AstrBot 中,默认提供了网页搜索、待办提醒、代码执行器这些工具。很多插件,如:
22+
23+
- astrbot_plugin_cloudmusic
24+
- astrbot_plugin_bilibili
25+
- ...
26+
27+
等在提供传统的指令调用的基础上,也提供了函数调用的功能。
28+
29+
你可以使用 `/tool ls` 命令查看当前具有工具列表。 可以使用 `/tool on` 或者 `/tool off` 命令开启或关闭某个工具。 可以使用 `/tool off_all` 命令关闭所有工具。
30+
31+
某些模型可能不支持函数调用,会返回诸如 `tool call is not supported`, `function calling is not supported`, `tool use is not supported` 等错误。在大多数情况下,AstrBot 能够检测到这种错误并自动帮您去除函数调用工具,但服务提供商太多,难免会有疏漏。如果你发现某个模型不支持函数调用,可以使用 `/tool off_all` 命令关闭所有工具,然后再次尝试。或者更换为支持函数调用的模型。
32+
33+
34+
下面是一些常见的工具调用 Demo:
35+
36+
![](../source/images/function-calling/image.png)
37+
38+
![](../source/images/function-calling/image-1.png)
39+

0 commit comments

Comments
 (0)