baidu qianfan agent chat

v1.0.0

千帆AI应用对话接口调用技能。用于调用百度千帆平台的对话API进行AI对话交互。支持流式和非流式响应、Function Call工具调用、文件上传等功能。触发场景:(1) 用户需要调用千帆对话API;(2) 用户提到"千帆"、"qianfan"、"百度AI对话";(3) 需要与千帆应用进行对话交互。

0· 184·0 current·0 all-time
byDavid Li@lilitong9607

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for lilitong9607/baidu-qianfan-agent-chat.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "baidu qianfan agent chat" (lilitong9607/baidu-qianfan-agent-chat) from ClawHub.
Skill page: https://clawhub.ai/lilitong9607/baidu-qianfan-agent-chat
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Required env vars: QIANFAN_API_KEY
Required binaries: python3
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install baidu-qianfan-agent-chat

ClawHub CLI

Package manager switcher

npx clawhub@latest install baidu-qianfan-agent-chat
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description state the skill calls Baidu 千帆 conversation API and the included script posts to https://qianfan.baidubce.com/v2/app/conversation/runs using an API key; required binary (python3) and required env var (QIANFAN_API_KEY) are consistent with this purpose.
Instruction Scope
SKILL.md and scripts/chat.py stay within the claimed scope: they only read QIANFAN_API_KEY, accept user-provided arguments (query, file ids, tools file, etc.), call the Qianfan API, and save a local session_id to a state file in the skill folder. There are no instructions to read unrelated system files or additional environment variables.
Install Mechanism
No install spec (instruction-only) — low install risk. One usability note: the script imports the third-party 'requests' library but the skill metadata does not declare installing it; the runtime environment must already have requests installed or the script will fail. This is an operational omission, not an overt security issue.
Credentials
Only a single credential (QIANFAN_API_KEY) is required, which is appropriate for calling the documented API. The skill does write a small session file under the skill directory (state/session.json) to remember conversation_id — this is expected behavior for multi-turn sessions.
Persistence & Privilege
always:false and no special privileges requested. The skill persists only its own session state file under the skill directory and does not modify other skills or system-wide agent settings.
Assessment
This skill appears to do exactly what it claims: call Baidu 千帆 conversation API using QIANFAN_API_KEY. Before installing, consider: (1) only provide a QIANFAN_API_KEY you trust to this skill — the key is sent to qianfan.baidubce.com; (2) ensure the runtime has python3 and the 'requests' Python package installed (the script imports requests but does not install it); (3) the script will create a local file state/session.json in the skill directory to store conversation_id — if you need no local state, run with --new-session or remove the file; (4) the skill performs network calls to the Baidu endpoint, so run it in an environment where outbound network access is acceptable; (5) if you want extra assurance, inspect or run the included scripts/chat.py manually before enabling autonomous invocation. Overall the components are internally consistent and proportionate to the described purpose.

Like a lobster shell, security has layers — review code before you run it.

Runtime requirements

🤖 Clawdis
Binspython3
EnvQIANFAN_API_KEY
latestvk975dj7k78b45rh9fmx835wnk58385z3
184downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

千帆对话技能

调用百度千帆平台的对话API,与千帆AI应用进行对话交互。

初始化配置

⚠️ 必须设置环境变量 QIANFAN_API_KEY

export QIANFAN_API_KEY="your-api-key-here"

API Key 可从 千帆平台 获取。

默认配置

配置项默认值说明
app_ide52a2419-4327-48e8-b9dc-9bf037199fc2应用ID,可在调用时通过 --app-id 覆盖
streamfalse流式返回

接口详情

详细的请求/响应参数、错误码、curl 示例等,请参阅 API 参考文档


基本用法

发起对话

使用 scripts/chat.py 脚本调用:

python3 scripts/chat.py --query "你好,请介绍一下自己"

参数说明

参数说明默认值
--query用户提问内容(必选)-
--app-id应用IDe52a2419-4327-48e8-b9dc-9bf037199fc2
--stream是否流式返回true
--conversation-id会话ID(多轮对话时传入)-
--file-ids文件ID列表,逗号分隔-

多轮对话

会话状态自动管理:

  • 首次调用不传 conversation_id,API返回后会自动保存
  • 后续调用自动使用已保存的 conversation_id
  • 使用 --new-session 开始新会话
# 首次对话(自动保存 conversation_id)
python3 scripts/chat.py --query "你好"
# 输出: [conversation_id: xxx-xxx-xxx]

# 后续对话(自动使用已保存的 conversation_id)
python3 scripts/chat.py --query "刚才我们聊了什么"
# 输出: [使用已保存的会话: xxx-xxx-xxx]

# 开始新会话
python3 scripts/chat.py --query "新话题" --new-session

手动指定会话ID:

python3 scripts/chat.py --query "继续" --conversation-id "xxx-xxx-xxx"

非流式响应

python3 scripts/chat.py --query "你好" --stream false

高级功能

Function Call

定义工具并上报结果:

python3 scripts/chat.py --query "今天北京天气" --tools-file tools/weather.json

注意事项

  1. 确保 QIANFAN_API_KEY 环境变量已设置
  2. 首次对话不需要 conversation_id,后续多轮对话需传入
  3. 流式模式下,响应以 data: 开头,以 data: [DONE] 结束

Comments

Loading comments...