mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-19 02:12:46 +08:00
docs: add version requirement for event hooks in message event guide
This commit is contained in:
@@ -291,6 +291,8 @@ async def on_llm_resp(self, event: AstrMessageEvent, resp: LLMResponse): # Note
|
||||
|
||||
#### On Agent Begin
|
||||
|
||||
> Requires AstrBot version > v4.23.1
|
||||
|
||||
When the Agent starts running, the `on_agent_begin` hook is triggered.
|
||||
|
||||
```python
|
||||
@@ -307,6 +309,8 @@ async def on_agent_begin(self, event: AstrMessageEvent, run_context: ContextWrap
|
||||
|
||||
#### Before LLM Tool Call
|
||||
|
||||
> Requires AstrBot version > v4.23.1
|
||||
|
||||
When the Agent is about to call an LLM tool, the `on_using_llm_tool` hook is triggered.
|
||||
|
||||
You can obtain the `FunctionTool` object and tool call arguments.
|
||||
@@ -329,6 +333,8 @@ async def on_using_llm_tool(
|
||||
|
||||
#### After LLM Tool Call
|
||||
|
||||
> Requires AstrBot version > v4.23.1
|
||||
|
||||
After the LLM tool call completes, the `on_llm_tool_respond` hook is triggered.
|
||||
|
||||
You can obtain the `FunctionTool` object, tool call arguments, and tool call result.
|
||||
@@ -354,6 +360,8 @@ async def on_llm_tool_respond(
|
||||
|
||||
#### On Agent Done
|
||||
|
||||
> Requires AstrBot version > v4.23.1
|
||||
|
||||
After the Agent finishes running, the `on_agent_done` hook is triggered. This hook is triggered after `on_llm_response`.
|
||||
|
||||
```python
|
||||
|
||||
@@ -307,6 +307,8 @@ async def on_llm_resp(self, event: AstrMessageEvent, resp: LLMResponse): # 请
|
||||
|
||||
#### Agent 开始运行时
|
||||
|
||||
> 适用于 AstrBot 版本 > v4.23.1
|
||||
|
||||
在 Agent 开始运行时,会触发 `on_agent_begin` 钩子。
|
||||
|
||||
```python
|
||||
@@ -323,6 +325,8 @@ async def on_agent_begin(self, event: AstrMessageEvent, run_context: ContextWrap
|
||||
|
||||
#### LLM 工具调用前
|
||||
|
||||
> 适用于 AstrBot 版本 > v4.23.1
|
||||
|
||||
在 Agent 准备调用 LLM 工具时,会触发 `on_using_llm_tool` 钩子。
|
||||
|
||||
可以获取到 `FunctionTool` 对象和工具调用参数。
|
||||
@@ -345,6 +349,8 @@ async def on_using_llm_tool(
|
||||
|
||||
#### LLM 工具调用后
|
||||
|
||||
> 适用于 AstrBot 版本 > v4.23.1
|
||||
|
||||
在 LLM 工具调用完成后,会触发 `on_llm_tool_respond` 钩子。
|
||||
|
||||
可以获取到 `FunctionTool` 对象、工具调用参数和工具调用结果。
|
||||
@@ -370,6 +376,8 @@ async def on_llm_tool_respond(
|
||||
|
||||
#### Agent 运行完成时
|
||||
|
||||
> 适用于 AstrBot 版本 > v4.23.1
|
||||
|
||||
在 Agent 运行完成后,会触发 `on_agent_done` 钩子。这个钩子会在 `on_llm_response` 之后触发。本质上和 `on_llm_response` 一样。
|
||||
|
||||
```python
|
||||
|
||||
@@ -509,6 +509,8 @@ async def on_llm_resp(self, event: AstrMessageEvent, resp: LLMResponse): # 请
|
||||
|
||||
##### Agent 开始运行时
|
||||
|
||||
> 适用于 AstrBot 版本 > v4.23.1
|
||||
|
||||
在 Agent 开始运行时,会触发 `on_agent_begin` 钩子。
|
||||
|
||||
```python
|
||||
@@ -525,6 +527,8 @@ async def on_agent_begin(self, event: AstrMessageEvent, run_context: ContextWrap
|
||||
|
||||
##### LLM 工具调用前
|
||||
|
||||
> 适用于 AstrBot 版本 > v4.23.1
|
||||
|
||||
在 Agent 准备调用 LLM 工具时,会触发 `on_using_llm_tool` 钩子。
|
||||
|
||||
可以获取到 `FunctionTool` 对象和工具调用参数。
|
||||
@@ -547,6 +551,8 @@ async def on_using_llm_tool(
|
||||
|
||||
##### LLM 工具调用后
|
||||
|
||||
> 适用于 AstrBot 版本 > v4.23.1
|
||||
|
||||
在 LLM 工具调用完成后,会触发 `on_llm_tool_respond` 钩子。
|
||||
|
||||
可以获取到 `FunctionTool` 对象、工具调用参数和工具调用结果。
|
||||
@@ -572,6 +578,8 @@ async def on_llm_tool_respond(
|
||||
|
||||
##### Agent 运行完成时
|
||||
|
||||
> 适用于 AstrBot 版本 > v4.23.1
|
||||
|
||||
在 Agent 运行完成后,会触发 `on_agent_done` 钩子。这个钩子会在 `on_llm_response` 之后触发。
|
||||
|
||||
可以获取到 `LLMResponse` 对象,可以对其进行修改。
|
||||
|
||||
Reference in New Issue
Block a user