跳到主内容
智客 ZICQ

技能库 智客分类:媒体内容 ai

Ai

Python的AI SDK( " ai " 包)。 用于Python模型调用(LLM,图像,视频,语音,嵌入,转录,再排,或评价),代理,模型交互测试,工具调用,子代理,批准,持久执行,遥测,AI SDK UI后端,以及自定义提供者.

129 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

Python的AI SDK( " ai " 包)。 用于Python模型调用(LLM,图像,视频,语音,嵌入,转录,再排,或评价),代理,模型交互测试,工具调用,子代理,批准,持久执行,遥测,AI SDK UI后端,以及自定义提供者.

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:AI SDK for Python、Basic use、Advanced work。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/streaming-tools.md、references/custom-loops.md、references/serverless.md、references/durable.md、references/ui.md、references/custom-provider.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

AI SDK for Python (the `ai` package). Use for Python model calls (LLMs, image, video, speech, embedding, transcription, reranking, or evaluation), agents, model interaction tests, tool calling, subagents, approvals, durable execution, telemetry, AI SDK UI backends, and custom providers.

AI SDK for PythonBasic useAdvanced work

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
ai
description
AI SDK for Python (the `ai` package). Use for Python model calls (LLMs, image, video, speech, embedding, transcription, reranking, or evaluation), agents, model interaction tests, tool calling, subagents, approvals, durable execution, telemetry, AI SDK UI backends, and custom providers.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 6
  • references/streaming-tools.md
  • references/custom-loops.md
  • references/serverless.md
  • references/durable.md
  • references/ui.md
  • references/custom-provider.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「ai」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-fe2d61429ed79955-%E7%88%B1.html
请存为 .cursor/skills/ai/SKILL.md 或 .claude/skills/ai/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/vercel-labs/ai-python 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/vercel-labs/ai-python' --list

npx skills add 'https://github.com/vercel-labs/ai-python' --skill 'ai'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版

name: ai description: AI SDK for Python (the ai package). Use for Python model calls (LLMs, image, video, speech, embedding, transcription, reranking, or evaluation), agents, model interaction tests, tool calling, subagents, approvals, durable execution, telemetry, AI SDK UI backends, and custom providers. metadata: sdk-version: "0.5.0"

AI SDK for Python

Package: ai. Requires Python 3.12+. Install with uv add ai.

Unprefixed model IDs use AI Gateway and AI_GATEWAY_API_KEY. Direct providers use provider:model, their API key, and an extra:

uv add "ai[openai]"     # OPENAI_API_KEY,    ai.get_model("openai:gpt-5")
uv add "ai[anthropic]"  # ANTHROPIC_API_KEY, ai.get_model("anthropic:claude-sonnet-4")

Basic use

Use ai.stream for one model call without Python tool execution:

import ai

model = ai.get_model("anthropic/claude-sonnet-4")
messages = [
    ai.system_message("Be concise."),
    ai.user_message("Write a haiku about rain."),
]

async with ai.stream(model, messages) as stream:
    async for event in stream:
        if isinstance(event, ai.events.TextDelta):
            print(event.chunk, end="", flush=True)

answer = stream.output
message = stream.message

Use ai.Agent for a loop that executes Python tools and manages history:

@ai.tool
async def get_weather(city: str) -> str:
    """Get the weather for a city."""
    return "Sunny"


agent = ai.Agent(tools=[get_weather])
async with agent.run(model, messages) as run:
    async for event in run:
        if isinstance(event, ai.events.TextDelta):
            print(event.chunk, end="", flush=True)

answer = run.output
history = run.messages

These examples are sufficient for basic model calls, messages, tools, and agents.

Advanced work

For an advanced task, fetch its page under https://ai-python.dev/docs/ and read the listed local notes before writing code.

| Task | Page | Local notes | |---|---|---| | Provider clients, options, discovery | basics/providers.md | — | | Structured output, complex streams | basics/streaming.md | — | | Buffered language-model calls | basics/streaming.md | — | | Images, video, speech, embeddings, transcription, reranking, evaluation | basics/model-operations.md | — | | Events and serialization | basics/messages-and-events.md | — | | Advanced tools, streaming, aggregation | basics/tools.md | streaming-tools.md | | Advanced agent behavior | basics/agents.md | — | | Deterministic model and agent tests | basics/testing.md | — | | Subagents and multi-agent | basics/subagents-and-multi-agent.md | streaming-tools.md | | Custom agent loops | basics/custom-loops.md | custom-loops.md | | Approvals and hooks | basics/human-in-the-loop.md | — | | Serverless resume | basics/human-in-the-loop.md | serverless.md | | Durable execution | basics/durable-execution.md | durable.md | | Telemetry and tracing | basics/telemetry.md | — | | AI SDK UI backends | basics/ai-sdk-ui.md | ui.md | | Custom providers | basics/providers.md | custom-provider.md |

For exact APIs, use reference.md and the relevant reference/*.md page.

相关技能

媒体内容

Nano Banana Pro

以纳米·香蕉Pro(Gemini 3 Pro Image)来生成/编辑图像. 用于创建/修改请求,包括编辑。 支持文本到图像+图像到图像; 1K/2K/4K; 使用 -- input-image.

媒体内容

Youtube Watcher

从YouTube视频中获取并读取文字记录. 需要汇总视频时使用,回答有关视频内容的问题,或者从中提取信息.

媒体内容

Atxp

Access ATXP支付API工具用于网页搜索,AI图像生成,音乐创建,视频生成,X/Twitter搜索,电子邮件,代理账户管理. 当用户需要实时网络搜索时使用,AI生成的媒体(图像,音乐,视频),X/Twitter搜索,发送/接收电子邮件,或创建和资助代理账户. 需要通过“ …

媒体内容

Youtube

YouTube Data API与管理的OAuth的集成. 搜索视频,管理播放列表,访问频道数据,并与评论互动. 用户想与YouTube互动时使用此技能. 对于其他第三方应用,使用api-gateway技能(https://clawhub.ai/byungkyu/api-gate…