add-function-examples

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Adding Function Examples

新增功能示例

Review the changes in the current branch, and identify new or modified features or bug fixes that would benefit from having an example in the
examples/ai-functions
directory. These examples are used for testing specific features against the actual provider APIs, and can also serve as documentation for users.
Determine for which kind of model and top-level function the example should be added. For a language model, the example should be added in two variants, one for
generateText
and one for
streamText
. For any other models kinds, add the example for the relevant top-level function (e.g.
generateImage
,
generateSpeech
).
After creating the example, run
pnpm type-check:full
; fix any errors encountered.
检查当前分支的变更,识别需要在
examples/ai-functions
目录下添加示例的新增/修改功能或bug修复。这些示例用于对接实际供应商API测试特定功能,同时也可作为用户的参考文档。
确定该示例应该对应哪种模型类型和顶层函数。如果是语言模型,需要添加两个版本的示例:一个适配
generateText
,一个适配
streamText
。对于其他任何类型的模型,为对应的相关顶层函数添加示例即可(例如
generateImage
generateSpeech
)。
创建示例后,运行
pnpm type-check:full
,修复遇到的所有错误。