command
Version:
v1.3.0
Opens a new window with list of versions in this module.
Published: Feb 26, 2026
License: MIT
Opens a new window with license information.
Imports: 8
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
简单对话 (Simple Chat)
使用 OpenAI Provider 发起一次基本的 LLM 对话请求,展示最简单的 AgentFlow 使用方式。
功能
- 创建 OpenAI Provider 并配置 API Key
- 发送单轮对话请求(ChatCompletion)
- 打印响应内容和 Token 使用量
前置条件
- Go 1.24+
- 环境变量
OPENAI_API_KEY
运行
cd examples/01_simple_chat
go run main.go
代码说明
通过 providers.OpenAIConfig 配置 Provider,使用 provider.Completion() 发送请求。演示了 AgentFlow LLM 抽象层的基本用法:构建 ChatRequest、调用 Provider、读取 ChatResponse。
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.