Skip to content

Commit 08a77ae

Browse files
authored
docs: add zh docs (#493)
1 parent c6d06a4 commit 08a77ae

26 files changed

+2327
-2
lines changed

docs/astro.config.mjs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const plugins = [
8787
paths: ['api/**'],
8888
},
8989
],
90-
exclude: ['ja/**'],
90+
exclude: ['ja/**', 'zh/**'],
9191
}),
9292
];
9393

@@ -97,131 +97,150 @@ const sidebar = [
9797
link: '/',
9898
translations: {
9999
ja: '概要',
100+
zh: '概述',
100101
},
101102
},
102103
{
103104
label: 'Quickstart',
104105
link: '/guides/quickstart',
105106
translations: {
106107
ja: 'クイックスタート',
108+
zh: '快速开始',
107109
},
108110
},
109111
{
110112
label: 'Guides',
111113
translations: {
112114
ja: 'ガイド',
115+
zh: '指南',
113116
},
114117
items: [
115118
{
116119
label: 'Agents',
117120
link: '/guides/agents',
118121
translations: {
119122
ja: 'エージェント',
123+
zh: '智能体',
120124
},
121125
},
122126
{
123127
label: 'Running Agents',
124128
link: '/guides/running-agents',
125129
translations: {
126130
ja: 'エージェントの実行',
131+
zh: '运行智能体',
127132
},
128133
},
129134
{
130135
label: 'Results',
131136
link: '/guides/results',
132137
translations: {
133138
ja: 'エージェントの実行結果',
139+
zh: '执行结果',
134140
},
135141
},
136142
{
137143
label: 'Tools',
138144
link: '/guides/tools',
139145
translations: {
140146
ja: 'ツール',
147+
zh: '工具',
141148
},
142149
},
143150
{
144151
label: 'Orchestrating multiple agents',
145152
link: '/guides/multi-agent',
146153
translations: {
147154
ja: 'マルチエージェント',
155+
zh: '多智能体编排',
148156
},
149157
},
150158
{
151159
label: 'Handoffs',
152160
link: '/guides/handoffs',
153161
translations: {
154162
ja: 'ハンドオフ',
163+
zh: '交接',
155164
},
156165
},
157166
{
158167
label: 'Context management',
159168
link: '/guides/context',
160169
translations: {
161170
ja: 'コンテキスト管理',
171+
zh: '上下文管理',
162172
},
163173
},
164174
{
165175
label: 'Models',
166176
link: '/guides/models',
167177
translations: {
168178
ja: 'モデル',
179+
zh: '模型',
169180
},
170181
},
171182
{
172183
label: 'Guardrails',
173184
link: '/guides/guardrails',
174185
translations: {
175186
ja: 'ガードレール',
187+
zh: '护栏',
176188
},
177189
},
178190
{
179191
label: 'Streaming',
180192
link: '/guides/streaming',
181193
translations: {
182194
ja: 'ストリーミング',
195+
zh: '流式传输',
183196
},
184197
},
185198
{
186199
label: 'Human-in-the-loop',
187200
link: '/guides/human-in-the-loop',
188201
translations: {
189202
ja: '人間の介入(HITL)',
203+
zh: '人机协作',
190204
},
191205
},
192206
{
193207
label: 'Model Context Protocol (MCP)',
194208
link: '/guides/mcp',
195209
translations: {
196210
ja: 'MCP 連携',
211+
zh: 'MCP 集成',
197212
},
198213
},
199214
{
200215
label: 'Tracing',
201216
link: '/guides/tracing',
202217
translations: {
203218
ja: 'トレーシング',
219+
zh: '追踪',
204220
},
205221
},
206222
{
207223
label: 'Configuring the SDK',
208224
link: '/guides/config',
209225
translations: {
210226
ja: 'SDK の設定',
227+
zh: 'SDK 配置',
211228
},
212229
},
213230
{
214231
label: 'Troubleshooting',
215232
link: '/guides/troubleshooting',
216233
translations: {
217234
ja: 'トラブルシューティング',
235+
zh: '故障排除',
218236
},
219237
},
220238
{
221239
label: 'Release process',
222240
link: '/guides/release',
223241
translations: {
224242
ja: 'リリースプロセス',
243+
zh: '发布流程',
225244
},
226245
},
227246
],
@@ -230,34 +249,39 @@ const sidebar = [
230249
label: 'Voice Agents',
231250
translations: {
232251
ja: '音声エージェント',
252+
zh: '语音智能体',
233253
},
234254
items: [
235255
{
236256
label: 'Overview',
237257
link: '/guides/voice-agents',
238258
translations: {
239259
ja: '音声エージェントの概要',
260+
zh: '语音智能体概述',
240261
},
241262
},
242263
{
243264
label: 'Quickstart',
244265
link: '/guides/voice-agents/quickstart',
245266
translations: {
246267
ja: 'クイックスタート',
268+
zh: '快速开始',
247269
},
248270
},
249271
{
250272
label: 'Building Voice Agents',
251273
link: '/guides/voice-agents/build',
252274
translations: {
253275
ja: '音声エージェントの構築',
276+
zh: '构建语音智能体',
254277
},
255278
},
256279
{
257280
label: 'Transport Mechanisms',
258281
link: '/guides/voice-agents/transport',
259282
translations: {
260283
ja: 'リアルタイムトランスポート',
284+
zh: '传输机制',
261285
},
262286
},
263287
],
@@ -266,20 +290,23 @@ const sidebar = [
266290
label: 'Extensions',
267291
translations: {
268292
ja: '拡張機能',
293+
zh: '扩展',
269294
},
270295
items: [
271296
{
272297
label: 'Use any model with the AI SDK',
273298
link: '/extensions/ai-sdk',
274299
translations: {
275300
ja: 'AI SDK で任意モデルを指定',
301+
zh: '使用 AI SDK 指定任意模型',
276302
},
277303
},
278304
{
279305
label: 'Connect Realtime Agents to Twilio',
280306
link: '/extensions/twilio',
281307
translations: {
282308
ja: 'Realtime Agent を Twilio に接続',
309+
zh: '将实时智能体连接到 Twilio',
283310
},
284311
},
285312
],
@@ -288,6 +315,7 @@ const sidebar = [
288315
label: 'API Reference',
289316
translations: {
290317
ja: 'APIリファレンス',
318+
zh: 'API 参考',
291319
},
292320
collapsed: false,
293321
items: [
@@ -350,6 +378,10 @@ export default defineConfig({
350378
label: '日本語',
351379
lang: 'ja',
352380
},
381+
zh: {
382+
label: '中文',
383+
lang: 'zh',
384+
},
353385
},
354386
social: [
355387
{
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
title: 使用任何模型与 Vercel 的 AI SDK
3+
description: Connect your Agents SDK agents to any model through the Vercel's AI SDK
4+
---
5+
6+
import { Aside, Steps, Code } from '@astrojs/starlight/components';
7+
import aiSdkSetupExample from '../../../../../../examples/docs/extensions/ai-sdk-setup.ts?raw';
8+
9+
<Aside type="caution">
10+
该适配器仍处于测试阶段。您在使用某些模型提供方时可能会遇到问题,尤其是较小的提供方。请通过
11+
[GitHub issues](https://github.com/openai/openai-agents-js/issues)
12+
报告任何问题,我们会尽快修复。
13+
</Aside>
14+
15+
开箱即用,Agents SDK 可通过 Responses API 或 Chat Completions API 与 OpenAI 模型配合使用。不过,如果您希望使用其他模型,[Vercel 的 AI SDK](https://sdk.vercel.ai/) 提供了多种受支持的模型,可通过此适配器接入 Agents SDK。
16+
17+
## 设置
18+
19+
<Steps>
20+
21+
1. 通过安装扩展包来安装 AI SDK 适配器:
22+
23+
```bash
24+
npm install @openai/agents-extensions
25+
```
26+
27+
2.[Vercel 的 AI SDK](https://ai-sdk.dev/docs/foundations/providers-and-models) 选择所需的模型包并进行安装:
28+
29+
```bash
30+
npm install @ai-sdk/openai
31+
```
32+
33+
3. 导入适配器和模型以连接到您的智能体:
34+
35+
```typescript
36+
import { openai } from '@ai-sdk/openai';
37+
import { aisdk } from '@openai/agents-extensions';
38+
```
39+
40+
4. 初始化模型实例,供该智能体使用:
41+
42+
```typescript
43+
const model = aisdk(openai('o4-mini'));
44+
```
45+
46+
</Steps>
47+
48+
<Aside type="caution">
49+
我们目前支持 ai-sdk 的模型提供方的 v2 模块,与 Vercel AI SDK v5
50+
兼容。如果您有特定原因需要继续使用 v1 模型提供方,可以从
51+
[examples/ai-sdk-v1](https://github.com/openai/openai-agents-js/tree/main/examples/ai-sdk-v1)
52+
复制该模块并将其包含到您的项目中。
53+
</Aside>
54+
55+
## 示例
56+
57+
<Code lang="typescript" code={aiSdkSetupExample} title="AI SDK 设置" />
58+
59+
## 提供方元数据传递
60+
61+
如果您需要随消息发送提供方特定的选项,请通过 `providerMetadata` 传递。这些值会直接转发给底层的 AI SDK 模型。例如,在 Agents SDK 中如下的 `providerData`
62+
63+
```ts
64+
providerData: {
65+
anthropic: {
66+
cacheControl: {
67+
type: 'ephemeral';
68+
}
69+
}
70+
}
71+
```
72+
73+
将会变为
74+
75+
```ts
76+
providerMetadata: {
77+
anthropic: {
78+
cacheControl: {
79+
type: 'ephemeral';
80+
}
81+
}
82+
}
83+
```
84+
85+
在使用 AI SDK 集成时。

0 commit comments

Comments
 (0)