跳转至

Simple Agent

Simple Agent 是最基础的智能体类型,适用于简单的问答场景。

特点

  • 轻量级,快速响应
  • 无需额外配置
  • 适合 FAQ、知识问答

使用方法

from tongagents.agents import SimpleAgent

agent = SimpleAgent(
    name="faq_bot",
    llm="gpt-4"
)

response = agent.chat("你好,请介绍一下自己")
print(response)

配置参数

参数 说明 默认值
name Agent 名称 -
llm 使用的模型 gpt-3.5-turbo
system_prompt 系统提示词 -
temperature 温度参数 0.7

示例

# 带系统提示词的 Simple Agent
agent = SimpleAgent(
    name="translator",
    system_prompt="你是一个翻译助手,将中文翻译成英文",
    llm="gpt-4"
)

result = agent.chat("今天天气真好")
# 输出: The weather is nice today.

适用场景

  • FAQ 问答
  • 知识库查询
  • 简单对话
  • 文本生成