"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)

## 開發(fā) Agent 執(zhí)行器

Agent 執(zhí)行器是 Agent 的運行時對象,負責(zé)調(diào)用 Agent 智能體,執(zhí)行它選擇的操作,并將結(jié)果傳回 Agent。以下是創(chuàng)建 Agent 執(zhí)行器的代碼。

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

FAQ

1. 如何創(chuàng)建自定義工具?

2. 什么是 ReAct 框架?

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

4. 開發(fā) Agent 時常見的挑戰(zhàn)是什么?

5. GLM-4 Agent 的應(yīng)用場景有哪些?

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

上一篇:

GLM-4 常用提示詞與應(yīng)用揭秘

下一篇:

OpenAI GPT-4 寫代碼的優(yōu)勢與應(yīng)用
#你可能也喜歡這些API文章!

我們有何不同?

API服務(wù)商零注冊

多API并行試用

數(shù)據(jù)驅(qū)動選型,提升決策效率

查看全部API→
??

熱門場景實測,選對API

#AI文本生成大模型API

對比大模型API的內(nèi)容創(chuàng)意新穎性、情感共鳴力、商業(yè)轉(zhuǎn)化潛力

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

#AI深度推理大模型API

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

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