"action": $TOOL_NAME,
"action_input": $INPUT
}

Follow this format:

Question: input question to answer
Thought: consider previous and subsequent steps
Action:

$JSON_BLOB

Observation: action result
... (repeat Thought/Action/Observation N times)
Thought: I know what to respond
Action:

{
"action": "Final Answer",
"action_input": "Final response to human"
}

Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:$JSON_BLOB then Observation

================================= Messages Placeholder ==============================

{chat_history}

================================ Human Message =================================

{input}

{agent_scratchpad}
(reminder to respond in a JSON blob no matter what)

## 開發 Agent 執行器

Agent 執行器是 Agent 的運行時對象,負責調用 Agent 智能體,執行它選擇的操作,并將結果傳回 Agent。以下是創建 Agent 執行器的代碼。

```python
from langchain.agents import AgentExecutor
agent_executor = AgentExecutor(agent=agent, tools=tools, handle_parsing_errors=True, verbose=True)

FAQ

1. 如何創建自定義工具?

2. 什么是 ReAct 框架?

3. 如何確保 Agent 的有效性?

4. 開發 Agent 時常見的挑戰是什么?

5. GLM-4 Agent 的應用場景有哪些?

通過以上步驟,您可以成功開發出一個功能強大的 GLM-4 Agent,實現智能任務處理和復雜決策。

上一篇:

GLM-4 常用提示詞與應用揭秘

下一篇:

OpenAI GPT-4 寫代碼的優勢與應用
#你可能也喜歡這些API文章!

我們有何不同?

API服務商零注冊

多API并行試用

數據驅動選型,提升決策效率

查看全部API→
??

熱門場景實測,選對API

#AI文本生成大模型API

對比大模型API的內容創意新穎性、情感共鳴力、商業轉化潛力

25個渠道
一鍵對比試用API 限時免費

#AI深度推理大模型API

對比大模型API的邏輯推理準確性、分析深度、可視化建議合理性

10個渠道
一鍵對比試用API 限時免費