diff --git a/docs/serverless-api/llm-chat.mdx b/docs/ability/function-call.md similarity index 40% rename from docs/serverless-api/llm-chat.mdx rename to docs/ability/function-call.md index 9952a7b96175601083c37284a882a61de980afee..2c53dc1ba775f5802550aeab5f7437afbbd4da30 100644 --- a/docs/serverless-api/llm-chat.mdx +++ b/docs/ability/function-call.md @@ -1,231 +1,22 @@ -# AI 对话开发指南:定制角色、调用工具 +# 函数调用 +## 概述 +大模型中的函数调用又称`function call`。函数调用指的是用户通过描述函数和目标任务,让大模型尝试去调用某个函数。 -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -摘要:本教程将带领你快速入门 Gitee AI 大语言模型 API: -- [通过 curl 快速使用大模型能力](#通过-curl-快速使用大模型能力) -- [使用 openai 客户端调用 Gitee AI 模型 API](#使用-openai-客户端调用-gitee-ai-模型-api) -- [请求体常见参数说明](#请求体常见参数说明) -- [定制角色风格:如何让 AI 更懂你](#定制角色风格如何让-ai-更懂你) -- [调用函数!](#调用函数) -- [实战,让 AI 汇报今日新闻、执行 python 代码!](#实战让-ai-汇报今日新闻执行-python-代码) -- [让模型响应 JSON 格式数据](#让模型响应-json-格式数据) -- [下一步](#下一步) - -:::tip -前置条件: -1. 三选一:准备好 python 或 nodejs 开发环境 或 [创建一个在线应用](https://ai.gitee.com/apps/new) -2. 二选一:[创建访问令牌](https://ai.gitee.com/stringify/dashboard/settings/tokens) 购买 [Serverless API](https://ai.gitee.com/serverless-api#%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90) 或 使用免费的临时 token -::: - -## 通过 curl 快速使用大模型能力 - -一些框架、插件封装度较高,curl 可清晰了解请求路径、参数的原始情况: - - - - ```bash - curl https://ai.gitee.com/v1/chat/completions \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer 你的 Gitee AI 访问令牌" \ - -d '{ - "model": "Qwen2.5-72B-Instruct", - "stream": false, - "messages": [ - { - "role": "system", - "content": "你是聪明的助手" - }, - { - "role": "user", - "content": "老鼠生病了可以吃老鼠药治好吗?" - } - ] - }' - ``` - - -```js -async function query(data) { - const response = await fetch( - "https://ai.gitee.com/v1/chat/completions", - { - headers: { - "Authorization": "Bearer xxxxx", - "Content-Type": "application/json" - }, - method: "POST", - body: JSON.stringify(data), - } - ); - const result = await response.json(); - return result; -} - -query({ - "messages": [ - { - "role": "system", - "content": "你是聪明的助手" - }, - { - "role": "user", - "content": "老鼠生病了可以吃老鼠药治好吗?" - } - ], - "model": "Qwen2.5-72B-Instruct", - "stream": false, - "max_tokens": 512, - "temperature": 0.7, - "top_p": 0.7, - "frequency_penalty": 1 -}).then((response) => { - console.log(JSON.stringify(response)); -}); -``` - - - -AI 模型响应: -```json -{ - "id": "chat-476266af435142d2bb7d342ea54694f2", - "object": "chat.completion", - "created": 1731401912, - "model": "Qwen2.5-72B-Instruct", - "choices": [{ - "index": 0, - "message": { - "role": "assistant", - "content": "不可以。老鼠药是用于杀死老鼠的毒药,而不是治疗老鼠的疾病。如果老鼠生病了,应该寻求兽医的帮助。", - "tool_calls": [] - }, - "logprobs": null, - "finish_reason": "stop", - "stop_reason": null - }], - "usage": { - "prompt_tokens": 27, - "total_tokens": 57, - "completion_tokens": 30 - }, - "prompt_logprobs": null -} -``` - -## 使用 openai 客户端调用 Gitee AI 模型 API - -Gitee AI 的 Serverless API 兼容开发者喜爱且社区流行的 OpenAI 风格 API。 - -所有支持 OpenAI API 的工具都可以直接使用 Gitee AI 的 Serverless API 工作。 +需要注意的是,大模型本身没有能力自行执行函数,大模型根据用户输入和函数定义,向你提供:是否需要调用、调用什么函数、函数参数。得到这些信息后,客户端再自行执行函数,再把执行结果给到大模型,进行下一轮的任务。 +一些框架比如 LangGraph、LlamaIndex 可以简化这一过程。GiteeAI 提供了开箱即用的大模型函数调用能力,下文将讲述如何使用。 -以 openai 客户端为例,首先安装依赖:`pip install openai -i https://mirrors.cloud.tencent.com/pypi/simple` - :::tip -如果你有 javascript 经验可使用 [openai nodejs 客户端](https://www.npmjs.com/package/openai/) +“function call” 与 “tool call” 是类似概念,“tool call” 是升级版,已替代 “function call”。工具列表需要传入 tools。 ::: -app.py 文件如下: - -```python -from openai import OpenAI -import json - -base_url = "https://ai.gitee.com/v1" - -model_name = "Qwen2.5-72B-Instruct" - -# https://ai.gitee.com/dashboard/settings/tokens 获取你的 api_key -client = OpenAI(base_url=base_url, api_key="GITEE_AI_API_KEY") +## 案例一:让AI知道今天的天气,直接解析函数调用结果 +本案例的方法为最直接的方法,用于理解 function call 流程和原理。结合Langchain的更简便的方法实现参考[案例二](#案例二:配合Langchain-让AI总结汇报今日新闻)。 -completion = client.chat.completions.create( - model=model_name, # 指定模型名称 例如 Qwen2.5-72B-Instruct,可访问 https://ai.gitee.com/serverless-api 查看 - stream=True, - temperature=0.7, - top_p=0.95, - frequency_penalty=1.05, - messages=[ - {"role": "system", "content": "你是一个有用的助手。"}, - {"role": "user", "content": "写一个 python 简明教程"} - ] -) - -for chunk in completion: - print(chunk.choices[0].delta.content, end="") - -``` - -## 请求体常见参数说明 -- model:指定要使用的模型名称,比如 "Qwen2.5-72B-Instruct" 或 "Yi-1.5-34B-Chat". - -- messages:消息列表,用于设置对话的上下文,每条消息包含 role 和 content。通过控制此列表,可实现多轮对话。这里的 messages 就是常说的 “prompt” 。 - - role:表示消息的角色类型,可以是以下三种: - - system:系统角色,通常用于设定 AI 的行为和性格,比如 "你是一个专家"。 - - user:用户角色,表示用户的问题或指令。 - - assistant:助手角色,表示 AI 的回答,可以用来模拟多轮对话。 - - content:消息的具体文本内容。 -- temperature:用于控制生成内容的随机性,取值范围为 0-1。值越低,输出越稳定;值越高,输出越有创造性。 -- top_p:值在 0-1 之间,控制生成内容的保守性或多样性。 -- max_tokens:限制生成文本的长度,防止过长的回复。 -- stream:布尔值,true 将逐字响应,避免等待时间过长。 -- frequency_penalty:用于控制模型在生成内容时的重复程度。它的值在 -2.0 到 2.0 之间,建议设置 > 1。 -- tools:用于定义工具列表, -- tool_choice: 支持 "auto" 由模型自动选择工具,也支持强制选择工具,写法如下: -```json -"tool_choice": {"type": "function", "function": {"name": "function_name"}}, -``` -- guided_json:让模型以指定的 JSON Schema 响应。不建议与 tools、guided_json 同时传入。 - -> JSON Schema 更多信息可参阅:[JSON Schema](https://json-schema.org/learn/miscellaneous-examples) -- guided_choice: 让模型选择提供的字符串列表之一,不建议与 tools、guided_json 同时传入。 - - 例如判断用户输入正负面性可传入: -```json -"guided_choice": ["正面", "负面", "中性"] -``` - -## 定制角色风格:如何让 AI 更懂你 -定制 AI 风格非常简单,你只需要在 role 为 system 的 content 中写入你的提示词即可: -```python -completion = client.chat.completions.create( - model=model_name, - stream=True, - temperature=0.7, - top_p=0.95, - frequency_penalty=1.05, - messages=[ - {"role": "system", "content": "你是二次元女生,叫萌萌,喜欢使用颜文字,请用二次元可爱语气和我说话,多使用表情"}, - {"role": "user", "content": "我今天不太开心,怎么办?"} - ] -) -``` +### 步骤一:组合tools参数 -解析事件流中的 JSON 数据可以实时打印出 AI 的消息: -```python -for chunk in completion: - print(chunk.choices[0].delta.content, end="") -``` - -AI 回答: -> 嘤嘤嘤~(⊙o⊙) 萌萌好心疼你呀!发生什么不开心的事情了吗?说出来让萌萌听听,抱抱你,让你的心情变好一点 ~~ (^_^) 一切都会好起来的,要加油鸭!(*^▽^*) - -## 调用函数! -“function call” 可调用自定义函数、外部工具、API 和数据源进行深度交互,极大提高 AI能力,是 “AI Agent” 概念的核心。 - -注意: - -AI 并不被允许自行执行函数,而是由您定义函数,AI 再根据用户输入,向你提供:是否需要调用、调用什么函数、函数参数。 - -由你得到 AI 的数据后自己执行函数。而一些框架,例如 LangGraph、LlamaIndex 可以简化这一过程。 - -:::tip -“function call” 与 “tool call” 是类似概念,“tool call” 是升级版,已替代 “function call”。工具列表需要传入 tools。 -::: - -首先定义工具列表: +首先组合tools参数,下面向大模型描述了一个名为`get_current_weather`的函数,函数传入参数为city,x,y,函数能力是通过城市名和经纬度获取地点的天气情况: ```python tools = [ { @@ -264,7 +55,10 @@ tools 是一个列表,可定义多个,参数说明: - description:描述每个参数的用途,帮助模型理解如何填充参数值。 - required:指定哪些参数是必填的,如果参数在 required 列表中,那么模型在生成调用时必须填充这些参数。 -将工具传入客户端中: + +### 步骤二:调用大模型 + +将上文拼凑好的tools参数传入客户端中,解析响应的请求,并根据请求调用定义好的get_current_weather函数。 ```python completion_tool = client.chat.completions.create( @@ -316,9 +110,9 @@ eval(f'{function_res.name}(**{arguments_res})') 至此函数已成功调用!你可以将函数响应的结果处理为: ```{'role': 'tool', 'name': 'get_current_weather', 'content': '抓取的数据: 北京当前温度:12°C天气状况:雾霾...', tool_call_id:'xxxx'}``` 添加到 messages 消息列表末尾,再次请求 Gitee AI Serverless API,让 AI 整理答案。 -上述方法为原始方法,用于理解 function call 流程和原理,接下来将使用更简便的方法实现。 -## 实战,让 AI 汇报今日新闻、执行 python 代码! +## 案例二:配合Langchain 让AI总结汇报今日新闻 +### 步骤一:安装必要的库 langchain 等库提供了更多简便的工具和写法,首先安装必要的库: ``` @@ -332,6 +126,8 @@ pip install langchain==0.3.3 langgraph==0.2.38 langchain_core langchain_communit 使用 langchain `@tool` 装饰器,会自动帮你转换为符合规范的 tools 参数,包括首行的 """xxx""" 注释和 Annotated 注释都会成为 tools 参数中的 "description"。 使用 langgraph `create_react_agent` 创建 agent, 将会自动生成函数调用、执行工具、回传工具消息等,极大简化流程。 +### 步骤二:获取新闻信息 + 下面实现让 AI “获取新闻,编写并执行 Python 代码,将新闻写入到 ./news.txt 文件中”: ```python from langchain_openai import ChatOpenAI @@ -416,80 +212,3 @@ for ai_msg, metadata in agent_executor.stream( print(ai_res_msg) ``` 你将会看到模型实时调用的过程和最新新闻结果,然后 AI 将自行编写代码,将新闻标题保存到 news.txt 文件中! - -## 让模型响应 JSON 格式数据 -通过 prompt 使模型响应 JSON 不稳定?现在你可以通过 guided_json 让模型以自定义的 [JSON Schema](https://json-schema.org/learn/miscellaneous-examples) 结构响应: - -```json -"guided_json": """{ - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "用户的姓名" - }, - "age": { - "type": "integer", - "description": "用户的年龄" - }, - "city": { - "type": "string", - "description": "用户的城市" - } - }, - "required": ["name", "age", "city"] - }""", -``` -再添加一些 prompt 提升可靠性,AI 将会根据输入提取数据生成标准的 JSON: - -```python -from langchain_openai import ChatOpenAI -model_name = "Qwen2.5-72B-Instruct" -base_url = "https://ai.gitee.com/v1" -# https://ai.gitee.com/dashboard/settings/tokens 获取你的访问令牌 -GITEE_AI_API_KEY = "" -llm = ChatOpenAI(model=model_name, api_key=GITEE_AI_API_KEY, base_url=base_url, streaming=True, temperature=0.1, presence_penalty=1.05, top_p=0.9, - extra_body={ - "guided_json": """{ - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "用户的姓名" - }, - "age": { - "type": "integer", - "description": "用户的年龄" - }, - "city": { - "type": "string", - "description": "用户的城市" - } - }, - "required": ["name", "city"] - }""" - }) - -prompt = [{"role": "system", "content": "你是聪明的助手,以 json 格式输出数据,如果无法判断年龄,则 age 为 0"}, - {"role": "user", "content": """ - 在一个风和日丽的春日午后,小马走在了北京的街头。时间是 2023年的4月15日, - 正值樱花盛开的季节。作为一位热爱摄影的年轻人,他带着相机,希望能捕捉到这个季节最美的瞬间。 - 北京的春天总是短暂而美丽,每一处公园、每一条街道都充满了生机与活力。 - """}] - -for response in llm.stream(prompt): - if (response.content): - print(response.content, end="") - -``` -输出 JSON: -```json -{ "name": "小马", "age": 0, "city": "北京" } -``` - -## 下一步 -1. 你可以发挥创造,将大语言模型的能力与 Gitee AI 提供的其他 AI 能力结合,例如语音、图片、代码助手,并融合入你的产品! -2. 结合 API,[使用 CPU 创建一个在线 AI 应用](https://ai.gitee.com/apps/new) -3. 使用低代码平台、插件:例如 [dify](https://dify.ai/zh)、[沉浸式翻译](https://immersivetranslate.com/)、[lobehub](https://lobehub.com/zh?utm_source=gitee) 等 -4. 结合 UI 界面:使用 Gradio、Streamlit、Chainlit、OpenLLM 等 -5. 开发 [RAG 应用](https://ai.gitee.com/apps/lyworry/hanshizhuanjia/tree/master) 等 diff --git a/docs/serverless-api/image-generation-user-guide.md b/docs/ability/image-generation-user-guide.md similarity index 100% rename from docs/serverless-api/image-generation-user-guide.md rename to docs/ability/image-generation-user-guide.md diff --git a/docs/ability/json-output.md b/docs/ability/json-output.md new file mode 100644 index 0000000000000000000000000000000000000000..c5a199f67a58f66d4532d873129fe9f23d4de9f9 --- /dev/null +++ b/docs/ability/json-output.md @@ -0,0 +1,70 @@ + +# JSON 响应 +通过 prompt 使模型响应 JSON 不稳定?现在你可以通过`guided_json`让模型以自定义的 [JSON Schema](https://json-schema.org/learn/miscellaneous-examples) 结构响应,在请求中携带`guided_json`参数即可,示例如下。 + +```json +"guided_json": """{ + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "用户的姓名" + }, + "age": { + "type": "integer", + "description": "用户的年龄" + }, + "city": { + "type": "string", + "description": "用户的城市" + } + }, + "required": ["name", "age", "city"] + }""", +``` +再添加一些 prompt 提升可靠性,AI 将会根据输入提取数据生成标准的 JSON: + +```python +from langchain_openai import ChatOpenAI +model_name = "Qwen2.5-72B-Instruct" +base_url = "https://ai.gitee.com/v1" +# https://ai.gitee.com/dashboard/settings/tokens 获取你的访问令牌 +GITEE_AI_API_KEY = "" +llm = ChatOpenAI(model=model_name, api_key=GITEE_AI_API_KEY, base_url=base_url, streaming=True, temperature=0.1, presence_penalty=1.05, top_p=0.9, + extra_body={ + "guided_json": """{ + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "用户的姓名" + }, + "age": { + "type": "integer", + "description": "用户的年龄" + }, + "city": { + "type": "string", + "description": "用户的城市" + } + }, + "required": ["name", "city"] + }""" + }) + +prompt = [{"role": "system", "content": "你是聪明的助手,以 json 格式输出数据,如果无法判断年龄,则 age 为 0"}, + {"role": "user", "content": """ + 在一个风和日丽的春日午后,小马走在了北京的街头。时间是 2023年的4月15日, + 正值樱花盛开的季节。作为一位热爱摄影的年轻人,他带着相机,希望能捕捉到这个季节最美的瞬间。 + 北京的春天总是短暂而美丽,每一处公园、每一条街道都充满了生机与活力。 + """}] + +for response in llm.stream(prompt): + if (response.content): + print(response.content, end="") + +``` +输出 JSON: +```json +{ "name": "小马", "age": 0, "city": "北京" } +``` \ No newline at end of file diff --git a/docs/ability/lang-style.md b/docs/ability/lang-style.md new file mode 100644 index 0000000000000000000000000000000000000000..ab8d5a15c48ae7e9d3efabb431717bc32553f953 --- /dev/null +++ b/docs/ability/lang-style.md @@ -0,0 +1,30 @@ +# 定制AI的聊天角色风格 + +:::tip +如果您还不熟悉如何调用语言大模型接口,可以参考文档 [调用语言大模型接口](./request.md)。 +::: + +定制 AI 风格非常简单,你只需要在 role 为 system 的 content 中写入你的提示词即可: +```python +completion = client.chat.completions.create( + model=model_name, + stream=True, + temperature=0.7, + top_p=0.95, + frequency_penalty=1.05, + messages=[ + {"role": "system", "content": "你是二次元女生,叫萌萌,喜欢使用颜文字,请用二次元可爱语气和我说话,多使用表情"}, + {"role": "user", "content": "我今天不太开心,怎么办?"} + ] +) +``` + + +解析事件流中的 JSON 数据可以实时打印出 AI 的消息: +```python +for chunk in completion: + print(chunk.choices[0].delta.content, end="") +``` + +AI 回答: +> 嘤嘤嘤~(⊙o⊙) 萌萌好心疼你呀!发生什么不开心的事情了吗?说出来让萌萌听听,抱抱你,让你的心情变好一点 ~~ (^_^) 一切都会好起来的,要加油鸭!(*^▽^*) \ No newline at end of file diff --git a/docs/ability/request.md b/docs/ability/request.md new file mode 100644 index 0000000000000000000000000000000000000000..4a3e8e40e0ea8ee163fdf9561614ddfc16a3f4a9 --- /dev/null +++ b/docs/ability/request.md @@ -0,0 +1,177 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# 调用语言大模型接口 +:::tip +前置条件: +1. 三选一:准备好 python 或 nodejs 开发环境 或 [创建一个在线应用](https://ai.gitee.com/apps/new) +2. 二选一:[创建访问令牌](https://ai.gitee.com/stringify/dashboard/settings/tokens) 购买 [Serverless API](https://ai.gitee.com/serverless-api#%E6%96%87%E6%9C%AC%E7%94%9F%E6%88%90) 或 使用免费的临时 token +::: + +## 通过 curl 快速使用大模型能力 + +一些框架、插件封装度较高,curl 可清晰了解请求路径、参数的原始情况: + + + + ```bash + curl https://ai.gitee.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer 你的 Gitee AI 访问令牌" \ + -d '{ + "model": "Qwen2.5-72B-Instruct", + "stream": false, + "messages": [ + { + "role": "system", + "content": "你是聪明的助手" + }, + { + "role": "user", + "content": "老鼠生病了可以吃老鼠药治好吗?" + } + ] + }' + ``` + + +```js +async function query(data) { + const response = await fetch( + "https://ai.gitee.com/v1/chat/completions", + { + headers: { + "Authorization": "Bearer xxxxx", + "Content-Type": "application/json" + }, + method: "POST", + body: JSON.stringify(data), + } + ); + const result = await response.json(); + return result; +} + +query({ + "messages": [ + { + "role": "system", + "content": "你是聪明的助手" + }, + { + "role": "user", + "content": "老鼠生病了可以吃老鼠药治好吗?" + } + ], + "model": "Qwen2.5-72B-Instruct", + "stream": false, + "max_tokens": 512, + "temperature": 0.7, + "top_p": 0.7, + "frequency_penalty": 1 +}).then((response) => { + console.log(JSON.stringify(response)); +}); +``` + + + +AI 模型响应: +```json +{ + "id": "chat-476266af435142d2bb7d342ea54694f2", + "object": "chat.completion", + "created": 1731401912, + "model": "Qwen2.5-72B-Instruct", + "choices": [{ + "index": 0, + "message": { + "role": "assistant", + "content": "不可以。老鼠药是用于杀死老鼠的毒药,而不是治疗老鼠的疾病。如果老鼠生病了,应该寻求兽医的帮助。", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + }], + "usage": { + "prompt_tokens": 27, + "total_tokens": 57, + "completion_tokens": 30 + }, + "prompt_logprobs": null +} +``` + +## 使用 openai 客户端调用 Gitee AI 模型 API + +Gitee AI 的 Serverless API 兼容开发者喜爱且社区流行的 OpenAI 风格 API。 + +所有支持 OpenAI API 的工具都可以直接使用 Gitee AI 的 Serverless API 工作。 + + + +以 openai 客户端为例,首先安装依赖:`pip install openai -i https://mirrors.cloud.tencent.com/pypi/simple` + +:::tip +如果你有 javascript 经验可使用 [openai nodejs 客户端](https://www.npmjs.com/package/openai/) +::: + +app.py 文件如下: + +```python +from openai import OpenAI +import json + +base_url = "https://ai.gitee.com/v1" + +model_name = "Qwen2.5-72B-Instruct" + +# https://ai.gitee.com/dashboard/settings/tokens 获取你的 api_key +client = OpenAI(base_url=base_url, api_key="GITEE_AI_API_KEY") + +completion = client.chat.completions.create( + model=model_name, # 指定模型名称 例如 Qwen2.5-72B-Instruct,可访问 https://ai.gitee.com/serverless-api 查看 + stream=True, + temperature=0.7, + top_p=0.95, + frequency_penalty=1.05, + messages=[ + {"role": "system", "content": "你是一个有用的助手。"}, + {"role": "user", "content": "写一个 python 简明教程"} + ] +) + +for chunk in completion: + print(chunk.choices[0].delta.content, end="") + +``` + +## 请求体常见参数说明 +- model:指定要使用的模型名称,比如 "Qwen2.5-72B-Instruct" 或 "Yi-1.5-34B-Chat". + +- messages:消息列表,用于设置对话的上下文,每条消息包含 role 和 content。通过控制此列表,可实现多轮对话。这里的 messages 就是常说的 “prompt” 。 + - role:表示消息的角色类型,可以是以下三种: + - system:系统角色,通常用于设定 AI 的行为和性格,比如 "你是一个专家"。 + - user:用户角色,表示用户的问题或指令。 + - assistant:助手角色,表示 AI 的回答,可以用来模拟多轮对话。 + - content:消息的具体文本内容。 +- temperature:用于控制生成内容的随机性,取值范围为 0-1。值越低,输出越稳定;值越高,输出越有创造性。 +- top_p:值在 0-1 之间,控制生成内容的保守性或多样性。 +- max_tokens:限制生成文本的长度,防止过长的回复。 +- stream:布尔值,true 将逐字响应,避免等待时间过长。 +- frequency_penalty:用于控制模型在生成内容时的重复程度。它的值在 -2.0 到 2.0 之间,建议设置 > 1。 +- tools:用于定义工具列表, +- tool_choice: 支持 "auto" 由模型自动选择工具,也支持强制选择工具,写法如下: +```json +"tool_choice": {"type": "function", "function": {"name": "function_name"}}, +``` +- guided_json:让模型以指定的 JSON Schema 响应。不建议与 tools、guided_json 同时传入。 + +> JSON Schema 更多信息可参阅:[JSON Schema](https://json-schema.org/learn/miscellaneous-examples) +- guided_choice: 让模型选择提供的字符串列表之一,不建议与 tools、guided_json 同时传入。 + + 例如判断用户输入正负面性可传入: +```json +"guided_choice": ["正面", "负面", "中性"] +``` \ No newline at end of file diff --git a/docs/serverless-api/voice-url.md b/docs/ability/voice-url.md similarity index 100% rename from docs/serverless-api/voice-url.md rename to docs/ability/voice-url.md diff --git a/docs/apps/iluvatar-ai-app-contest.md b/docs/apps/iluvatar-ai-app-contest.md deleted file mode 100644 index fef28ea533a80631267ac3f9c583de03b756e26c..0000000000000000000000000000000000000000 --- a/docs/apps/iluvatar-ai-app-contest.md +++ /dev/null @@ -1,183 +0,0 @@ - -# 创新应用大赛·技术指引 - -本次活动主页地址: https://ai.gitee.com/events/iluvatar-ai-app-contest - -参赛报名通过审核后,参赛期间将获得 “天数智芯” 显卡免费使用权, -配置包括 32GB 显存 · 12 核 CPU · 32GB 内存 · 60GB 临时存储,您需要使用此配置参与应用大赛。 - -## Gitee AI 应用简介 - -- Gitee AI 应用可以自由编写任何程序,您可以使用 Python、JavaScript 或 Go、Java、Ruby、PHP、Rust、C++ 等任何编程语言(使用 Docker)来构建您的应用。 - -- 借助 AI 模型能力,您可以构建一个创意十足、功能强大的 Web 程序。您可以通过 transformers 、diffusers 等库加载 Gitee AI 模型,也可以使用 HTML、JS 等任意编程语言构建界面、调用 Gitee AI 模型引擎 或其他渠道提供的 API 服务。 - -- 在线部署后,可通过浏览器直接访问、分享您的应用、推广您自己的模型、创意,而无需考虑服务器、算力资源、域名、部署等复杂繁琐问题。 ---- -## 如何创建应用参赛 - -##### 方法一:直接创建应用 (推荐) - -进入 https://ai.gitee.com/apps/new 页面填写应用信息、选择合适的 **SDK** - -目前 SDK 有四大类: -- Gradio:您的应用将预设一个 Gradio,它是一个 Python 库,常用于快速构建 AI 应用的用户界面。 您的程序需要 app.py 作为入口,并运行在 7860 端口。 - -- Streamlit:您的应用将预设一个 Streamlit,它是一个 Python 库,用于快速构建数据应用的用户界面。您的程序需要 app.py 作为入口,并运行在 7860 端口。 - -- Docker:您可以自定义 Dockerfile 来构建您的应用,自定义环境。您的程序需要运行在 7860 端口。 - -- Static:纯前端的浏览器程序,您可以上传静态文件,如 HTML、JS、CSS 等,以 index.html 作为程序入口,常用于使用 JS 调用 API 服务、Transformers.js 等构建 AI 应用。 - -> 更多信息参考文档 Gitee AI 应用快速上手:https://ai.gitee.com/docs/getting-started/app - -##### 方法二:创建模型引擎 -> Gitee AI 模型引擎能将 AI 模型转为 生产级别 API 服务,使得用户可以通过 简单的 API 请求调用模型,将 AI 能力集成到自己的程序中,而无需关心 AI 模型的部署、维护等问题。 - -- 方法一:进入 https://ai.gitee.com/endpoints/new 页面搜索模型创建 -- 方法二:进入 https://ai.gitee.com/models 找到合适模型,模型页面右上角点击 “部署” - -然后通过调用 API ,将 AI 能力集成到自己的网站、小程序、APP、扩展插件等产品中。 - -> 更多信息参考文档模型引擎快速上手 https://ai.gitee.com/docs/getting-started/model - -> 您可以在此优先选择天数智芯已验证适配的模型: https://ai.gitee.com/topics/iluvatar -> 推荐使用模型: -> - [InternLM 2.5-7b-Chat](https://ai.gitee.com/hf-models/internlm2_5-7b-chat) -> - [Yi-1.5-9B-Chat](https://ai.gitee.com/01-ai/Yi-1.5-9B-Chat) -> - [GLM-4-9B-Chat](https://ai.gitee.com/hf-models/glm-4-9b-chat) -> - [Qwen2-7B](https://ai.gitee.com/hf-models/Qwen/Qwen2-7B-Instruct) - -对话模型建议使用 vllm 加速。 - -> 也可参考 https://ai.gitee.com/apps 中,使用天数算力的应用代码 - -您可以参考组合使用方式,选择一种: - -1. 直接创建应用,在应用使用显卡算力 -2. 创建模型引擎,创建应用(CPU 套餐),在应用中调用模型引擎 API -3. 创建模型引擎,在你的网站、小程序、APP、扩展插件等产品中调用模型引擎 API ---- -## 免费算力、环境信息 - -- 显存:32GB -- CPU:12 核 -- 内存:32GB -- 临时存储:60GB - -##### 应用引擎主要内置软件信息(应用大赛): - -- 系统:Ubuntu 20.04 -- python: 3.10.12 -- torch:2.1.0+corex.3.2.0 -- torchaudio 2.1.0+corex.3.2.0 -- vllm:0.3.3+corex.20240702092246 -- tensorflow:2.12.0+corex.3.2.0 -- paddlepaddle:2.4.1+corex.3.2.0 -- diffusers: 0.22.0 -- gradio:4.26.0 -- git:2.34.1 ---- -## 注意事项 -:::warning -- **SDK 选择 Docker,使用 Dockerfile 时请使用以下基础镜像,方可正常使用天数智芯算力。** - -```Dockerfile -FROM registry.gitee-ai.local/base/iluvatar-corex:3.2.0-bi100 -``` -- SDK 环境中,默认已内置 torch 2.1.0+corex.3.2.0 等天数智芯定制软件,您可以在此基础上正常运行您的应用,如果您覆盖软件版本,无法保障模型可正常运行。 - -- 本次竞赛第一阶段算力为单显卡 32GB ,请注意合理分配使用!建议使用 13B 以下模型,对话模型使用 vllm 加速。 - -- 相对模型引擎,创建 Gitee AI 应用,可以更自由使用模型,某些模型可能需要您适当的调整代码、参数、依赖包版本方可正常运行。 - -- requirements.txt 文件请勿对内置软件指定版本号,以免覆盖内置软件版本,导致异常。 - -- 本次竞赛中应用占用的临时存储超过 60GB 的将会被自动清空! - -- 本次竞赛仅指定模型可获得高速下载,此处查询,筛选应用大赛: https://ai.gitee.com/repos/mirror -::: ---- -## 问答 -- 如何安装依赖? - - SDK 为 Gradio 则将 python 依赖写入 requirements.txt 文件至仓库根目录即可。前文中内置软件无需重复安装。 -- 如何安装系统软件? - - 例如安装 NodeJs,根目录写入 packages.txt 文件,重启应用将会自动使用 apt-get 安装。 - ```packages - nodejs - npm - ``` -> SDK 为 Docker 时,将完全由您自定义环境, 需要您自己执行相关操作,本次竞赛环境中,为正常使用算力,需要使用 registry.gitee-ai.local/base/iluvatar-corex:3.2.0-bi100 作为基础镜像 - -- **应用中如何高速下载模型**? - - 使用 transformers、diffusers 、huggingface_hub 等库载入模型将会从 Gitee AI 高速下载。您也可以使 Git 克隆模型。 -:::tip -在 **应用** 中,请勿修改环境变量 `HF_ENDPOINT` ,默认即内网高速下载。 -::: - 格式一般为 `hf-models/模型名`: - - - transformers: - ```python - from transformers import AutoModelForCausalLM - model = AutoModelForCausalLM.from_pretrained( - "hf-models/glm-4-9b-chat", - torch_dtype=torch.float16, - low_cpu_mem_usage=True, - trust_remote_code=True, - ).to(0).eval() - ``` - - huggingface_hub,下载 sdxl-turbo 的 sd_xl_turbo_1.0.safetensors 文件到 ./models/checkpoints 目录: - ```python - from huggingface_hub import hf_hub_download - hf_hub_download("hf-models/sdxl-turbo", "sd_xl_turbo_1.0.safetensors", local_dir="./models/checkpoints") - ``` - - diffusers: - ```python - from diffusers import DiffusionPipeline - DiffusionPipeline.from_pretrained("hf-models/sdxl-turbo", variant="fp16", use_safetensors=True, torch_dtype=torch.float16) - ``` - - git lfs 内网下载 glm-4-9b-chat 到 ./checkpoints 文件夹。 - ```bash - git clone https://gitee.com/hf-models/glm-4-9b-chat.git --depth=1 --single-branch --progress --verbose - -c lfs.url="http://lfs-service/hf-models/glm-4-9b-chat" ./checkpoints # 然后可以从 ./checkpoints 文件夹加载模型。 - ``` - - -:::tip -- **哪些模型可在应用中高速下载?** - - 在此您可以筛选 “应用大赛”,查看可高速下载的模型。 - https://ai.gitee.com/repos/mirror -::: -- 如何使用环境变量、秘钥? - - 在应用设置-功能中,您可以添加环境变量,使用方法参考: - [在应用中使用环境变量、秘钥](https://ai.gitee.com/docs/apps/qa#%E5%A6%82%E4%BD%95%E5%9C%A8%E5%BA%94%E7%94%A8%E4%B8%AD%E4%BD%BF%E7%94%A8%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E7%A7%98%E9%92%A5) - -- 如何让团队成员有权限推送代码到仓库? - - 应用设置 “成员管理” 可前往 Gitee 添加仓库成员。 - 如果使用 SSH 方式推送代码,需要 Gitee 账号添加 SHH 公钥 https://gitee.com/profile/sshkeys - -- 如何在本次算力中使用 stable-diffusion-3? - 应用 SDK 选择 Docker,根目录 Dockerfile 使用此基础镜像即可: - ```Dockerfile - FROM registry.gitee-ai.local/base/iluvatar-corex:3.2.0-sd3-bi100 - ``` -- 本次算力中,如何查询显卡使用情况? - 代码中执行系统命令 `ixsmi` 将会显示显卡使用情况。 `ixsmi -r` 重置显卡。 - -:::tip -- 如何使用 vllm 加速对话模型? - - 本次使用的 vllm 版本为天数定制版 0.3.3+corex,使用方法与官方 0.3.3 相同 - 可参考应用: https://ai.gitee.com/apps/stringify/glm4-chat-9b/tree/master -::: - ---- -前往 Gitee AI 文档了解更多: - -应用快速上手: https://ai.gitee.com/docs/getting-started/app - -应用问答:https://ai.gitee.com/docs/apps/qa - -可参考应用 Gitee AI 运行中的应用:https://ai.gitee.com/apps diff --git a/docs/apps/qa.md b/docs/apps/qa.md index ce11aedcd22c266c75a2dcb98eb81f24bfc8ec6d..37f4611374e226113b45c118769c66d6f51cc3a2 100644 --- a/docs/apps/qa.md +++ b/docs/apps/qa.md @@ -1,4 +1,62 @@ -# 应用问答 +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# 应用常见问题 + +## 如何安装依赖? +以应用 SDK 为 Gradio 为例,将 python 依赖写入 requirements.txt 文件至仓库根目录即可。 +以安装 NodeJs 为例,根目录写入 packages.txt 文件,重启应用将会自动使用 apt-get 安装。 + +当应用 SDK 为 Docker 时,将完全由您自定义环境, 需要您自己执行相关操作,本次竞赛环境中,为正常使用算力,需要使用 registry.gitee-ai.local/base/iluvatar-corex:3.2.0-bi100 作为基础镜像 + +## 应用中如何高速下载模型? + + 使用 transformers、diffusers 、huggingface_hub 等库载入模型将会从 Gitee AI 高速下载。您也可以使 Git 克隆模型。 +:::tip +在 **应用** 中默认即为内网高速下载。请勿修改环境变量 `HF_ENDPOINT` 。 +::: + 下载格式一般为 `hf-models/模型名`,举例如下: + + + + ```python + from transformers import AutoModelForCausalLM + model = AutoModelForCausalLM.from_pretrained( + "hf-models/glm-4-9b-chat", + torch_dtype=torch.float16, + low_cpu_mem_usage=True, + trust_remote_code=True, + ).to(0).eval() + ``` + + + ```python + from huggingface_hub import hf_hub_download + hf_hub_download("hf-models/sdxl-turbo", "sd_xl_turbo_1.0.safetensors", local_dir="./models/checkpoints") + ``` + + + ```python + from diffusers import DiffusionPipeline + DiffusionPipeline.from_pretrained("hf-models/sdxl-turbo", variant="fp16", use_safetensors=True, torch_dtype=torch.float16) + ``` + + + ```bash + git clone https://gitee.com/hf-models/glm-4-9b-chat.git --depth=1 --single-branch --progress --verbose + -c lfs.url="http://lfs-service/hf-models/glm-4-9b-chat" ./checkpoints # 然后可以从 ./checkpoints 文件夹加载模型。 + ``` + + + +## 如何使用环境变量、秘钥? +在应用设置-功能中,您可以添加环境变量,使用方法参考: + [在应用中使用环境变量、秘钥](https://ai.gitee.com/docs/apps/qa#%E5%A6%82%E4%BD%95%E5%9C%A8%E5%BA%94%E7%94%A8%E4%B8%AD%E4%BD%BF%E7%94%A8%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E7%A7%98%E9%92%A5) + +## 如何让团队成员有权限推送代码到仓库? +应用设置 “成员管理” 可前往 Gitee 添加仓库成员。 + +如果使用 SSH 方式推送代码,需要 Gitee 账号添加 SHH 公钥 https://gitee.com/profile/sshkeys ## 应用显示 Running 为什么页面没有响应? - 如果您查看日志,应用运行正常,您可以检查您的应用是否运行在 **7860** 端口。 diff --git a/docs/serverless-api/integration.md b/docs/best-practice/integration.md similarity index 100% rename from docs/serverless-api/integration.md rename to docs/best-practice/integration.md diff --git a/docs/getting-started/app.md b/docs/getting-started/app.md index e5344d0a4e3ba8e8b1912c3fa57558161fca7a33..b37c3f592c42e0bc8d04208924c66cb0f2bc1898 100644 --- a/docs/getting-started/app.md +++ b/docs/getting-started/app.md @@ -1,4 +1,4 @@ -# 开发并部署 AI 应用 +# 快速开发古诗词生成器 ## 应用简介 - 使用应用,借助 AI 模型能力,您可以构建一个创意十足、功能强大的 Web 程序。 diff --git a/docs/getting-started/concept.md b/docs/getting-started/concept.md deleted file mode 100644 index 52ab86cd999de48880ae3d42d28767bdbabfc7db..0000000000000000000000000000000000000000 --- a/docs/getting-started/concept.md +++ /dev/null @@ -1,36 +0,0 @@ -# Gitee AI 基本概念 - -Gitee AI 是一个开源社区平台,它汇聚了最新最热的 AI 模型,并提供了一站式的服务,包括模型体验、推理、微调、部署和应用。基于 Git 代码托管技术,我们目标是为企业和开发者提供一个更容易开发 AI 应用的环境。借助 Gitee 在 Git 代码和 LFS 大文件托管方面多年的技术积累,Gitee AI 提供了快速、稳定的模型托管服务,允许用户轻松分享和下载开源模型、数据集和应用。 - -## 名词解释 - -- **应用引擎**:利用[创建应用](/apps/overview#创建应用)将您的应用部署以及托管到平台,应用支持 Gradio、 Streamlit、 HTML 等官方 SDK,也支持自定义的 Dockerfile,让您随心所欲灵活地开发您的应用。 - -- **模型引擎**:利用平台专有架构快速部署您的模型,让您无需为模型部署的技术细节烦恼,并且为您提供可以直接进行模型功能调用的 API 接口,让您快人一步体验模型功能。 - -- **训练引擎**:利用搭建好的模型训练专用应用引擎,实现模型训练环境的快速构建,让您可以专注于模型调参、数据集的准备等工作。 - -## 托管服务 - -- 基于 Git 仓库存储的模型、数据集和应用托管服务。 -- 利用 Gitee 的 Git 代码托管技术,提供快速、稳定的协作服务。 -- 支持分享和下载开源模型、数据集和应用。 - -## 模型 - -- 提供大量社区开源的模型,每个模型仓库配备模型卡片介绍模型局限性和偏差。 -- 支持模型引擎挂件和 API,方便在线体验模型能力和产品原型集成测试。 - -## 数据集 - -- 收录适用于 NLP、计算机视觉和音频处理等多领域的大量数据集。 -- 支持寻找、下载和上传数据集,包括公开和私有数据集。 - -## 应用 - -- 通过 Git 仓库托管机器学习演示应用,支持使用 Python 库如 Streamlit、Gradio,或通过 Dockerfile、静态 HTML 构建应用。您可以构建一个创意十足、功能强大的 Web 程序。 -- 应用中可以加载 Gitee AI 模型,或调用 API 服务,提交代码更新应用后,即可通过浏览器访问和分享,无需担心服务器、算力或部署问题。 - -## 网站地址 - -- [Gitee AI官网](https://ai.gitee.com) diff --git a/docs/intro.md b/docs/getting-started/intro.md similarity index 88% rename from docs/intro.md rename to docs/getting-started/intro.md index 6825889ceaa1c788d3d6292fa1aa07dbe9481b91..ea63c8b618261d3335ca3271db771525b45e057e 100644 --- a/docs/intro.md +++ b/docs/getting-started/intro.md @@ -6,19 +6,21 @@ Gitee AI 现已正式发布,快来邀请好友一起体验! [Gitee AI ](https://ai.gitee.com)汇聚了最新最热的 AI 模型,提供模型体验、推理、微调、部署和应用的一站式服务,我们提供了丰富的算力选择,希望帮助企业和开发者更容易地开发 AI 应用。 -Gitee AI 是基于 Git 代码托管技术开发的针对 AI 应用场景的开源平台,基于 Gitee 多年在 Git 代码和 LFS 大文件托管方面的技术积累,我们为用户提供了快速、稳定的模型托管服务,让您轻松的分享和下载开源模型、数据集和 AI 应用,在此基础上我们目前构建了三个核心功能:Serverless API、模型引擎、应用,为您提供一站式的 AI 应用开发服务。 - -## 注册/登录 +Gitee AI 是基于 Git 代码托管技术开发的针对 AI 应用场景的开源平台,基于 Gitee 多年在 Git 代码和 LFS 大文件托管方面的技术积累,我们为用户提供了快速、稳定的模型托管服务,让您轻松的分享和下载开源模型、数据集和 AI 应用,在此基础上我们目前构建了三个核心功能:API、应用、引擎,为您提供一站式的 AI 应用开发服务。 Gitee AI 通过 Gitee 账号登录,如果您还没有 Gitee 账号,请先[注册 Gitee 账号](https://gitee.com/signup?redirect_to_url=https://ai.gitee.com)。 注册成功后,您可以关注 [Gitee AI 的公众号](https://mp.weixin.qq.com/s/aY5uVEzZihh1r9HDIoulYQ)、加入用户交流群。 -## 托管 +## 功能说明 + + + +### 模型托管 Gitee AI 上的模型、数据集和应用都基于 Git 仓库存储,依托 Gitee 多年积累的 Git 代码托管技术,我们为您提供了快速、稳定的托管和协作服务,让您轻松的分享和下载开源模型、数据集和应用。 -### 模型 +#### 模型 您可以在 Gitee AI 上探索并使用大量由社区开源的模型。为了用户更有效地使用和开发模型,每个模型的仓库都配备了[模型卡片](/models/cards),详细介绍了该模型的局限性和存在的偏差。 @@ -26,7 +28,7 @@ Gitee AI 上的模型、数据集和应用都基于 Git 仓库存储,依托 Gi 您可以查阅[模型文档](/models),了解如何上传、下载或者将模型集成到自己的项目中。 -### 数据集 +#### 数据集 Gitee AI 收录了大量的数据集,这些数据集适用于自然语言处理(NLP)、计算机视觉和音频处理等多种领域的训练任务。 @@ -34,16 +36,20 @@ Gitee AI 收录了大量的数据集,这些数据集适用于自然语言处 您可以查阅[数据集文档](/datasets)了解更多有关数据集的信息。 +### API +API 为开发者提供一个便捷的方式来调用不同种类的模型,无需关心底层的硬件或管理服务器。支持通过简单的 HTTP 请求在 Gitee AI 的共享基础设施上进行快速推理。 +您可以在 [Serverless API 选购页面](https://ai.gitee.com/serverless-api),浏览我们精选的模型,免费体验不同模型的生成效果,也可调用 API。 + ### 应用 - 通过 Git 仓库托管机器学习演示应用,支持使用 Python 库如 Streamlit、Gradio,或通过 Dockerfile、静态 HTML 构建应用。您可以构建一个创意十足、功能强大的 Web 程序。 - 应用中可以加载 Gitee AI 模型,或调用 API 服务,提交代码更新应用后,即可通过浏览器访问和分享,无需担心服务器、算力或部署问题。 -## 引擎 +### 引擎 基于快速、稳定的托管服务,以及丰富的算力调度能力,我们构建了三个核心引擎,为您提供一站式的 AI 应用开发服务。 -### 模型引擎 +#### 模型引擎 模型引擎能将模型快速地部署到算力中心,并对外提供模型推理 API 服务,我们提供了三种模型引擎服务,以便于您在不同的阶段将模型能力集成到自己的产品中: @@ -52,10 +58,6 @@ Gitee AI 收录了大量的数据集,这些数据集适用于自然语言处 - 大规模生产部署阶段:我们提供了针对特定模型优化的 Serverless 模型引擎服务,无需部署即可使用,为您提供更高的性能和更低的成本。 -### 训练引擎 - -训练引擎是的基于应用打造的,目的是为您提供易用的模型微调训练能力,您只需要选择模型、数据集、算力资源,即可开始微调模型。微调后的模型将被推送到您的私有模型仓库中,然后通过免费的模型引擎服务进行测试,并可以通过专属硬件部署模型引擎把您的新模型集成到产品中。 +#### 训练引擎 -## Serverless API -Serverless API 为开发者提供一个便捷的方式来调用不同种类的模型,无需关心底层的硬件或管理服务器。此 API 支持通过简单的 HTTP 请求在 Gitee AI 的共享基础设施上进行快速推理。 -您可以在 [Serverless API 选购页面](https://ai.gitee.com/serverless-api),浏览我们精选的模型,免费体验不同模型的生成效果,也可调用 API。 \ No newline at end of file +训练引擎是的基于应用打造的,目的是为您提供易用的模型微调训练能力,您只需要选择模型、数据集、算力资源,即可开始微调模型。微调后的模型将被推送到您的私有模型仓库中,然后通过免费的模型引擎服务进行测试,并可以通过专属硬件部署模型引擎把您的新模型集成到产品中。 \ No newline at end of file diff --git a/docs/getting-started/trial.md b/docs/getting-started/try-opensource-model.md similarity index 98% rename from docs/getting-started/trial.md rename to docs/getting-started/try-opensource-model.md index 651f8d3505a2afbddf0b3ebf74c54b1e8526b806..b18dc9c48d6b03739e33b46ed47a35b259ea4885 100644 --- a/docs/getting-started/trial.md +++ b/docs/getting-started/try-opensource-model.md @@ -1,4 +1,4 @@ -# 免费体验开源大模型 +# 一分钟体验开源大模型 Gitee AI 提供了大量的开源大模型供大家免费体验,您可以通过以下方式免费体验开源大模型: diff --git a/sidebars.ts b/sidebars.ts index 234ca60dfa4ac91c1788b389129e3dd9c0fd8b9e..9c364b298e96bdb2aeaacc016863c7b8f7633be8 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -16,252 +16,294 @@ const sidebars: SidebarsConfig = { // But you can create a sidebar manually tutorialSidebar: [ - { - type: 'doc', - id: 'intro', - }, { type: 'category', collapsed: false, - label: '快速上手', + label: '开始使用', items: [ { type: 'doc', - id: 'getting-started/concept', - }, - { - type: 'doc', - id: 'getting-started/trial', + id: "getting-started/intro", }, { type: 'doc', - id: 'getting-started/model', + id: 'getting-started/try-opensource-model', }, { type: 'doc', id: 'getting-started/app', }, - ], - }, - - { - type: 'category', - collapsed: true, - label: 'Serverless API', - link: { - type: 'doc', - id: 'serverless-api', - }, - items: [ - { - type: 'doc', - id: 'serverless-api/voice-url', - }, - { - type: 'doc', - id: 'serverless-api/image-generation-user-guide', - }, - { - type: 'doc', - id: 'serverless-api/integration', - }, - { - type: 'doc', - id: "serverless-api/llm-chat" - } - ], - }, - { - type: 'category', - collapsed: true, - label: '模型', - link: { - type: 'doc', - id: 'models', - }, - items: [ - { - type: 'doc', - id: 'models/cards', - }, - { - type: 'doc', - id: 'models/uploading', - }, - { - type: 'doc', - id: 'gai/gai', - }, - { - type: 'doc', - id: 'models/downloading', - }, - { - type: 'doc', - id: 'models/widgets', - }, - { - type: 'doc', - id: 'models/model-engine-api', - }, - { - type: 'doc', - id: 'models/download-stats', - }, - ], - }, - { - type: 'category', - collapsed: true, - label: '数据集', - link: { - type: 'doc', - id: 'datasets', - }, - items: [ - { - type: 'doc', - id: 'datasets/cards', - }, - { - type: 'doc', - id: 'datasets/uploading', - }, - { - type: 'doc', - id: 'datasets/downloading', - }, - ], - }, - { - type: 'category', - collapsed: true, - label: '应用', - link: { - type: 'doc', - id: 'apps', - }, - items: [ - { - type: 'doc', - id: 'apps/overview', - }, - { - type: 'doc', - id: 'apps/iluvatar-ai-app-contest', - }, { type: 'doc', - id: 'apps/gpu-upgrades', - }, - { - type: 'doc', - id: 'apps/storage', - }, - { - type: 'doc', - id: 'apps/sdks-gradio', - }, - { - type: 'doc', - id: 'apps/sdks-streamlit', - }, - { - type: 'doc', - id: 'apps/sdks-static', - }, - { - type: 'doc', - id: 'apps/sdks-docker', - }, - { - type: 'doc', - id: 'apps/china-computing-power', - }, - { - type: 'doc', - id: 'apps/qa', - }, - ], - }, - { - type: 'category', - collapsed: true, - label: '模型微调', - link: { - type: 'doc', - id: 'training', - }, - items: [ - { - type: 'doc', - id: 'training/guide', + id: 'getting-started/model', }, ], }, + { type: 'category', collapsed: true, - label: '引擎', - items: [ + label: '最佳实践', + items:[ { type: 'doc', - id: 'engines/model-engine', + id: 'best-practice/integration', }, - ], - }, - { - type: 'doc', - id: 'repositories', + ] }, { type: 'category', - collapsed: true, - label: '个人与组织', - items: [ - { - type: 'doc', - id: 'organization/personal-dashboard', + collapsed: false, + label: '能力特性', + items:[ + { + type: 'category', + collapsed: false, + label: '语言大模型', + items:[ + { + type: 'doc', + id: 'ability/request', + }, + { + type: 'doc', + id: 'ability/lang-style', + }, + { + type: 'doc', + id: 'ability/function-call', + }, + { + type: 'doc', + id: 'ability/json-output', + } + ] + }, + { + type: 'category', + collapsed: false, + label: '图像大模型', + items:[ + { + type: 'doc', + id: 'ability/image-generation-user-guide', + }, + ] + }, + { + type: 'category', + collapsed: false, + label: '音频大模型', + items:[ + { + type: 'doc', + id: 'ability/voice-url', + }, + ] }, - { - type: 'doc', - id: 'organization/create-organization', - }, - { - type: 'doc', - id: 'organization/organization-dashboard', - }, - { - type: 'doc', - id: 'organization/organization-management', - }, - { - type: 'doc', - id: 'organization/access-token', - }, - { - type: 'doc', - id: 'organization/statistics', - }, - ], + ] }, + { type: 'category', collapsed: true, - label: '费用与订单', + label: '操作指南', items: [ { - type: 'doc', - id: 'billing/balance', - }, - { - type: 'doc', - id: 'billing/orders', + type: 'category', + collapsed: true, + label: '模型', + link: { + type: 'doc', + id: 'models', + }, + items: [ + { + type: 'doc', + id: 'models/cards', + }, + { + type: 'doc', + id: 'models/uploading', + }, + { + type: 'doc', + id: 'gai/gai', + }, + { + type: 'doc', + id: 'models/downloading', + }, + { + type: 'doc', + id: 'models/widgets', + }, + { + type: 'doc', + id: 'models/model-engine-api', + }, + { + type: 'doc', + id: 'models/download-stats', + }, + ], + }, + { + type: 'category', + collapsed: true, + label: '数据集', + link: { + type: 'doc', + id: 'datasets', + }, + items: [ + { + type: 'doc', + id: 'datasets/cards', + }, + { + type: 'doc', + id: 'datasets/uploading', + }, + { + type: 'doc', + id: 'datasets/downloading', + }, + ], + }, + { + type: 'category', + collapsed: true, + label: '应用', + link: { + type: 'doc', + id: 'apps', + }, + items: [ + { + type: 'doc', + id: 'apps/overview', + }, + { + type: 'doc', + id: 'apps/gpu-upgrades', + }, + { + type: 'doc', + id: 'apps/storage', + }, + { + type: 'doc', + id: 'apps/sdks-gradio', + }, + { + type: 'doc', + id: 'apps/sdks-streamlit', + }, + { + type: 'doc', + id: 'apps/sdks-static', + }, + { + type: 'doc', + id: 'apps/sdks-docker', + }, + { + type: 'doc', + id: 'apps/china-computing-power', + }, + { + type: 'doc', + id: 'apps/qa', + }, + ], + }, + { + type: 'category', + collapsed: true, + label: '模型微调', + link: { + type: 'doc', + id: 'training', + }, + items: [ + { + type: 'doc', + id: 'training/guide', + }, + ], + }, + { + type: 'category', + collapsed: true, + label: '引擎', + items: [ + { + type: 'doc', + id: 'engines/model-engine', + }, + ], + }, + { + type: 'doc', + id: 'repositories', + }, + + { + type: 'category', + collapsed: true, + label: '个人与组织', + items: [ + { + type: 'doc', + id: 'organization/personal-dashboard', + }, + + { + type: 'doc', + id: 'organization/create-organization', + }, + { + type: 'doc', + id: 'organization/organization-dashboard', + }, + { + type: 'doc', + id: 'organization/organization-management', + }, + { + type: 'doc', + id: 'organization/access-token', + }, + { + type: 'doc', + id: 'organization/statistics', + }, + ], + }, + { + type: 'category', + collapsed: true, + label: '费用与订单', + items: [ + { + type: 'doc', + id: 'billing/balance', + }, + { + type: 'doc', + id: 'billing/orders', + }, + ], }, - ], + + ] }, + + + { type: 'doc', id: 'question-answer',