diff --git a/README.md b/README.md index 92d1f9b..6059478 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Dify x OpenAPI -[![Dify Version Support](https://img.shields.io/badge/Support_Dify_Version-1.6.0-blue)](https://github.com/langgenius/dify) +[![Dify Version Support](https://img.shields.io/badge/Support_Dify_Version-1.7.0-blue)](https://github.com/langgenius/dify) [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![Package Manager: uv](https://img.shields.io/badge/package%20manager-uv-black)](https://github.com/astral-sh/uv) @@ -39,7 +39,7 @@ Provides OpenAPI Schema for [Dify](https://github.com/langgenius/dify) API, whic > [!tip] > This indicates that the API has passed at least one test case request. If you find any API errors, feel free to submit an issue or PR! -- Knowledge Base: [OpenAPI Schema(中文)](./schema/knowledge_base.zh.yaml) | [OpenAPI Schema(English)](./schema/knowledge_base.en.yaml) | [Official Documentation Source](https://github.com/langgenius/dify/tree/1.6.0/web/app/(commonLayout)/datasets/template) +- Knowledge Base: [OpenAPI Schema(中文)](./schema/knowledge_base.zh.yaml) | [OpenAPI Schema(English)](./schema/knowledge_base.en.yaml) | [Official Documentation Source](https://github.com/langgenius/dify/tree/1.7.0/web/app/(commonLayout)/datasets/template) - [x] POST /datasets - Create empty knowledge base - [x] POST /datasets/{dataset_id} - Update knowledge base - [x] GET /datasets/{dataset_id}/documents - Get document list @@ -71,7 +71,7 @@ Provides OpenAPI Schema for [Dify](https://github.com/langgenius/dify) API, whic - [x] POST /datasets/{dataset_id}/tags - Query dataset bound tags - [x] POST /datasets/{dataset_id}/retrieval - Retrieve with metadata filtering conditions -- Chat Application: [OpenAPI Schema(中文)](./schema/app_chat.zh.yaml) | [OpenAPI Schema(English)](./schema/app_chat.en.yaml) | [Official Documentation Source](https://github.com/langgenius/dify/tree/1.6.0/web/app/components/develop/template) +- Chat Application: [OpenAPI Schema(中文)](./schema/app_chat.zh.yaml) | [OpenAPI Schema(English)](./schema/app_chat.en.yaml) | [Official Documentation Source](https://github.com/langgenius/dify/tree/1.7.0/web/app/components/develop/template) - [x] POST /chat-messages - Send conversation message - [x] POST /files/upload - Upload file - [x] POST /messages/{message_id}/feedbacks - Message feedback @@ -84,7 +84,7 @@ Provides OpenAPI Schema for [Dify](https://github.com/langgenius/dify) API, whic - [x] GET /info - Get application basic information - [x] GET /parameters - Get application parameters -- Advanced Chat Application: [OpenAPI Schema(中文)](./schema/app_advanced_chat.zh.yaml) | [OpenAPI Schema(English)](./schema/app_advanced_chat.en.yaml) | [Official Documentation Source](https://github.com/langgenius/dify/tree/1.6.0/web/app/components/develop/template) +- Advanced Chat Application: [OpenAPI Schema(中文)](./schema/app_advanced_chat.zh.yaml) | [OpenAPI Schema(English)](./schema/app_advanced_chat.en.yaml) | [Official Documentation Source](https://github.com/langgenius/dify/tree/1.7.0/web/app/components/develop/template) - [x] POST /audio-to-text - Speech to text - [x] POST /text-to-audio - Text to speech - [x] GET /apps/annotations - Get annotation list @@ -100,10 +100,10 @@ Provides OpenAPI Schema for [Dify](https://github.com/langgenius/dify) API, whic - [x] GET /parameters - Get application parameters -- Text Generation Application: [OpenAPI Schema(中文)](./schema/app_generation.zh.yaml) | [OpenAPI Schema(English)](./schema/app_generation.en.yaml) | [Official Documentation Source](https://github.com/langgenius/dify/tree/1.6.0/web/app/components/develop/template) +- Text Generation Application: [OpenAPI Schema(中文)](./schema/app_generation.zh.yaml) | [OpenAPI Schema(English)](./schema/app_generation.en.yaml) | [Official Documentation Source](https://github.com/langgenius/dify/tree/1.7.0/web/app/components/develop/template) - [x] POST /completion-messages - Send message -- Workflow Application: [OpenAPI Schema(中文)](./schema/app_workflow.zh.yaml) | [OpenAPI Schema(English)](./schema/app_workflow.en.yaml) | [Official Documentation Source](https://github.com/langgenius/dify/tree/1.6.0/web/app/components/develop/template) +- Workflow Application: [OpenAPI Schema(中文)](./schema/app_workflow.zh.yaml) | [OpenAPI Schema(English)](./schema/app_workflow.en.yaml) | [Official Documentation Source](https://github.com/langgenius/dify/tree/1.7.0/web/app/components/develop/template) - [x] POST /workflows/run - Execute workflow - [x] GET /workflows/run/{workflow_run_id} - Get workflow execution status - [x] POST /workflows/tasks/{task_id}/stop - Stop response diff --git a/README.zh.md b/README.zh.md index dfed89b..75585b5 100644 --- a/README.zh.md +++ b/README.zh.md @@ -1,6 +1,6 @@ # Dify x OpenAPI -[![Dify Version Support](https://img.shields.io/badge/Support_Dify_Version-1.6.0-blue)](https://github.com/langgenius/dify) +[![Dify Version Support](https://img.shields.io/badge/Support_Dify_Version-1.7.0-blue)](https://github.com/langgenius/dify) [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![Package Manager: uv](https://img.shields.io/badge/package%20manager-uv-black)](https://github.com/astral-sh/uv) @@ -41,7 +41,7 @@ > [!tip] > 这里指至少可以通过一次测试用例请求, 如果你发现有哪些API错误, 欢迎提issue或者pr! -- 知识库: [OpenAPI Schema(中文)](./schema/knowledge_base.zh.yaml) | [OpenAPI Schema(English)](./schema/knowledge_base.en.yaml) | [官方文档源码](https://github.com/langgenius/dify/tree/1.6.0/web/app/(commonLayout)/datasets/template) +- 知识库: [OpenAPI Schema(中文)](./schema/knowledge_base.zh.yaml) | [OpenAPI Schema(English)](./schema/knowledge_base.en.yaml) | [官方文档源码](https://github.com/langgenius/dify/tree/1.7.0/web/app/(commonLayout)/datasets/template) - [x] POST /datasets - 创建空知识库 - [x] POST /datasets/{dataset_id} - 更新知识库 - [x] GET /datasets/{dataset_id}/documents - 获取文档列表 @@ -73,7 +73,7 @@ - [x] POST /datasets/{dataset_id}/tags - 查询知识库已绑定的标签 - [x] POST /datasets/{dataset_id}/retrieval - 带元数据过滤条件的检索 -- 聊天应用: [OpenAPI Schema(中文)](./schema/app_chat.zh.yaml) | [OpenAPI Schema(English)](./schema/app_chat.en.yaml) | [官方文档源码](https://github.com/langgenius/dify/tree/1.6.0/web/app/components/develop/template) +- 聊天应用: [OpenAPI Schema(中文)](./schema/app_chat.zh.yaml) | [OpenAPI Schema(English)](./schema/app_chat.en.yaml) | [官方文档源码](https://github.com/langgenius/dify/tree/1.7.0/web/app/components/develop/template) - [x] POST /chat-messages - 发送对话消息 - [x] POST /files/upload - 上传文件 - [x] POST /messages/{message_id}/feedbacks - 消息反馈 @@ -86,7 +86,7 @@ - [x] GET /info - 获取应用基本信息 - [x] GET /parameters - 获取应用参数 -- 高级聊天应用: [OpenAPI Schema(中文)](./schema/app_advanced_chat.zh.yaml) | [OpenAPI Schema(English)](./schema/app_advanced_chat.en.yaml) | [官方文档源码](https://github.com/langgenius/dify/tree/1.6.0/web/app/components/develop/template) +- 高级聊天应用: [OpenAPI Schema(中文)](./schema/app_advanced_chat.zh.yaml) | [OpenAPI Schema(English)](./schema/app_advanced_chat.en.yaml) | [官方文档源码](https://github.com/langgenius/dify/tree/1.7.0/web/app/components/develop/template) - [x] POST /audio-to-text - 语音转文字 - [x] POST /text-to-audio - 文字转语音 - [x] GET /apps/annotations - 获取标注列表 @@ -101,10 +101,10 @@ - [x] GET /info - 获取应用基本信息 - [x] GET /parameters - 获取应用参数(包含文字转语音设置) -- 文本生成应用: [OpenAPI Schema(中文)](./schema/app_generation.zh.yaml) | [OpenAPI Schema(English)](./schema/app_generation.en.yaml) | [官方文档源码](https://github.com/langgenius/dify/tree/1.6.0/web/app/components/develop/template) +- 文本生成应用: [OpenAPI Schema(中文)](./schema/app_generation.zh.yaml) | [OpenAPI Schema(English)](./schema/app_generation.en.yaml) | [官方文档源码](https://github.com/langgenius/dify/tree/1.7.0/web/app/components/develop/template) - [x] POST /completion-messages - 发送消息 -- 工作流应用: [OpenAPI Schema(中文)](./schema/app_workflow.zh.yaml) | [OpenAPI Schema(English)](./schema/app_workflow.en.yaml) | [官方文档源码](https://github.com/langgenius/dify/tree/1.6.0/web/app/components/develop/template) +- 工作流应用: [OpenAPI Schema(中文)](./schema/app_workflow.zh.yaml) | [OpenAPI Schema(English)](./schema/app_workflow.en.yaml) | [官方文档源码](https://github.com/langgenius/dify/tree/1.7.0/web/app/components/develop/template) - [x] POST /workflows/run - 执行工作流 - [x] GET /workflows/run/{workflow_run_id} - 获取工作流执行状态 - [x] POST /workflows/tasks/{task_id}/stop - 停止响应 diff --git a/libs/dify b/libs/dify index f4df80e..31985d9 160000 --- a/libs/dify +++ b/libs/dify @@ -1 +1 @@ -Subproject commit f4df80e093dfc433013fde12f52bb1b32b3f7b85 +Subproject commit 31985d94fa41210ba06962202bea316963cd06bc diff --git a/misc/official_api_doc_changes/1.6.0__1.7.0.diff b/misc/official_api_doc_changes/1.6.0__1.7.0.diff new file mode 100644 index 0000000..e7b63e7 --- /dev/null +++ b/misc/official_api_doc_changes/1.6.0__1.7.0.diff @@ -0,0 +1,209 @@ +diff --git a/web/app/components/develop/template/template.zh.mdx b/web/app/components/develop/template/template.zh.mdx +index 4af5a2805..a5eea3d19 100755 +--- a/web/app/components/develop/template/template.zh.mdx ++++ b/web/app/components/develop/template/template.zh.mdx +@@ -552,11 +552,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' + - `default` (string) 默认值 + - `options` (array[string]) 选项值 + - `file_upload` (object) 文件上传配置 +- - `image` (object) 图片设置 +- 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif` +- - `enabled` (bool) 是否开启 +- - `number_limits` (int) 图片数量限制,默认 3 +- - `transfer_methods` (array[string]) 传递方式列表,remote_url , local_file,必选一个 ++ - `document` (object) 文档设置 ++ 当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 文档数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `image` (object) 图片设置 ++ 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 图片数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `audio` (object) 音频设置 ++ 当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 音频数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `video` (object) 视频设置 ++ 当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 视频数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `custom` (object) 自定义设置 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 自定义数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 + - `system_parameters` (object) 系统参数 + - `file_size_limit` (int) 文档上传大小限制 (MB) + - `image_file_size_limit` (int) 图片文件上传大小限制(MB) +diff --git a/web/app/components/develop/template/template_advanced_chat.zh.mdx b/web/app/components/develop/template/template_advanced_chat.zh.mdx +index 7a69ee60a..30068d93a 100755 +--- a/web/app/components/develop/template/template_advanced_chat.zh.mdx ++++ b/web/app/components/develop/template/template_advanced_chat.zh.mdx +@@ -78,6 +78,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' + + (选填)自动生成标题,默认 `true`。 若设置为 `false`,则可通过调用会话重命名接口并设置 `auto_generate` 为 `true` 实现异步生成标题。 + ++ ++ (选填)链路追踪ID。适用于与业务系统已有的trace组件打通,实现端到端分布式追踪等场景。如果未指定,系统会自动生成trace_id。支持以下三种方式传递,具体优先级依次为:
++ - Header:通过 HTTP Header X-Trace-Id 传递,优先级最高。
++ - Query 参数:通过 URL 查询参数 trace_id 传递。
++ - Request Body:通过请求体字段 trace_id 传递(即本字段)。
++
+ + + ### Response +@@ -1229,11 +1235,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' + - `default` (string) 默认值 + - `options` (array[string]) 选项值 + - `file_upload` (object) 文件上传配置 +- - `image` (object) 图片设置 +- 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif` +- - `enabled` (bool) 是否开启 +- - `number_limits` (int) 图片数量限制,默认 3 +- - `transfer_methods` (array[string]) 传递方式列表,remote_url , local_file,必选一个 ++ - `document` (object) 文档设置 ++ 当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 文档数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `image` (object) 图片设置 ++ 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 图片数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `audio` (object) 音频设置 ++ 当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 音频数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `video` (object) 视频设置 ++ 当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 视频数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `custom` (object) 自定义设置 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 自定义数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 + - `system_parameters` (object) 系统参数 + - `file_size_limit` (int) Document upload size limit (MB) + - `image_file_size_limit` (int) Image file upload size limit (MB) +diff --git a/web/app/components/develop/template/template_chat.zh.mdx b/web/app/components/develop/template/template_chat.zh.mdx +index 325470ac6..a7127d614 100644 +--- a/web/app/components/develop/template/template_chat.zh.mdx ++++ b/web/app/components/develop/template/template_chat.zh.mdx +@@ -73,6 +73,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' + + (选填)自动生成标题,默认 `true`。 若设置为 `false`,则可通过调用会话重命名接口并设置 `auto_generate` 为 `true` 实现异步生成标题。 + ++ ++ (选填)链路追踪ID。适用于与业务系统已有的trace组件打通,实现端到端分布式追踪等场景。如果未指定,系统会自动生成trace_id。支持以下三种方式传递,具体优先级依次为:
++ - Header:通过 HTTP Header X-Trace-Id 传递,优先级最高。
++ - Query 参数:通过 URL 查询参数 trace_id 传递。
++ - Request Body:通过请求体字段 trace_id 传递(即本字段)。
++
+ + + ### Response +@@ -1237,11 +1243,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' + - `default` (string) 默认值 + - `options` (array[string]) 选项值 + - `file_upload` (object) 文件上传配置 +- - `image` (object) 图片设置 +- 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif` +- - `enabled` (bool) 是否开启 +- - `number_limits` (int) 图片数量限制,默认 3 +- - `transfer_methods` (array[string]) 传递方式列表,remote_url , local_file,必选一个 ++ - `document` (object) 文档设置 ++ 当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 文档数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `image` (object) 图片设置 ++ 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 图片数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `audio` (object) 音频设置 ++ 当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 音频数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `video` (object) 视频设置 ++ 当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 视频数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `custom` (object) 自定义设置 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 自定义数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 + - `system_parameters` (object) 系统参数 + - `file_size_limit` (int) 文档上传大小限制 (MB) + - `image_file_size_limit` (int) 图片文件上传大小限制(MB) +diff --git a/web/app/components/develop/template/template_workflow.zh.mdx b/web/app/components/develop/template/template_workflow.zh.mdx +index fc193de5d..236da62e8 100644 +--- a/web/app/components/develop/template/template_workflow.zh.mdx ++++ b/web/app/components/develop/template/template_workflow.zh.mdx +@@ -60,7 +60,12 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等 + - `user` (string) Required + 用户标识,用于定义终端用户的身份,方便检索、统计。 + 由开发者定义规则,需保证用户标识在应用内唯一。API 无法访问 WebApp 创建的会话。 +- ++ - `files` (array[object]) 可选 ++ - `trace_id` (string) Optional ++ 链路追踪ID。适用于与业务系统已有的trace组件打通,实现端到端分布式追踪等场景。如果未指定,系统将自动生成 `trace_id`。支持以下三种方式传递,具体优先级依次为: ++ 1. Header:推荐通过 HTTP Header `X-Trace-Id` 传递,优先级最高。 ++ 2. Query 参数:通过 URL 查询参数 `trace_id` 传递。 ++ 3. Request Body:通过请求体字段 `trace_id` 传递(即本字段)。 + + ### Response + 当 `response_mode` 为 `blocking` 时,返回 CompletionResponse object。 +@@ -333,7 +338,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等 + + 根据 workflow 执行 ID 获取 workflow 任务当前执行结果 + ### Path +- - `workflow_run_id` (string) workflow_run_id,可在流式返回 Chunk 中获取 ++ - `workflow_run_id` (string) workflow 执行 ID,可在流式返回 Chunk 中获取 + ### Response + - `id` (string) workflow 执行 ID + - `workflow_id` (string) 关联的 Workflow ID +@@ -678,11 +683,30 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等 + - `default` (string) 默认值 + - `options` (array[string]) 选项值 + - `file_upload` (object) 文件上传配置 +- - `image` (object) 图片设置 +- 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif` +- - `enabled` (bool) 是否开启 +- - `number_limits` (int) 图片数量限制,默认 3 +- - `transfer_methods` (array[string]) 传递方式列表,remote_url , local_file,必选一个 ++ - `document` (object) 文档设置 ++ 当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 文档数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `image` (object) 图片设置 ++ 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 图片数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `audio` (object) 音频设置 ++ 当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 音频数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `video` (object) 视频设置 ++ 当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 视频数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 ++ - `custom` (object) 自定义设置 ++ - `enabled` (bool) 是否启用 ++ - `number_limits` (int) 自定义数量限制,默认为 3 ++ - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。 + - `system_parameters` (object) 系统参数 + - `file_size_limit` (int) 文档上传大小限制 (MB) + - `image_file_size_limit` (int) 图片文件上传大小限制(MB) diff --git a/pyproject.toml b/pyproject.toml index 98f68a1..191bde5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "dify-openapi" -version = "1.6.0" +version = "1.7.0" description = "a client for testing and validating dify openapi schema" readme = "README.md" authors = [{ name = "straydragon", email = "straydragonl@foxmail.com" }] diff --git a/schema/app_advanced_chat.en.yaml b/schema/app_advanced_chat.en.yaml index 972f43b..da02e4d 100644 --- a/schema/app_advanced_chat.en.yaml +++ b/schema/app_advanced_chat.en.yaml @@ -6,8 +6,8 @@ info: Chat applications support session persistence, allowing previous chat history to be used as context for responses, suitable for chat/customer service AI, etc. All API requests require an application-level API-Key in the Authorization HTTP Header. It is strongly recommended that developers store the API-Key on the backend rather than sharing or storing it on the client side to prevent API-Key leakage and financial loss. - official raw document: https://github.com/langgenius/dify/blob/1.4.3/web/app/components/develop/template/template_advanced_chat.en.mdx - version: 1.6.0 + official raw document: https://github.com/langgenius/dify/blob/1.7.0/web/app/components/develop/template/template_advanced_chat.en.mdx + version: 1.7.0 servers: - url: 'https://api.dify.ai/v1' description: Dify API Server @@ -350,6 +350,9 @@ paths: type: boolean description: '(Optional) Automatically generate title, default `true`. If set to `false`, you can call the conversation rename interface and set `auto_generate` to `true` to generate a title asynchronously.' default: true + trace_id: + type: string + description: '(Optional) Trace ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Three methods are supported with the following priority order: Header: Pass through HTTP Header X-Trace-Id, highest priority. Query parameter: Pass through URL query parameter trace_id. Request Body: Pass through request body field trace_id (this field).' x-fern-streaming: format: sse # FIXME: @l8ng fern 暂时不支持 @@ -626,6 +629,25 @@ paths: file_upload: type: object properties: + document: + type: object + properties: + enabled: + type: boolean + description: Whether to enable + number_limits: + type: integer + description: 'Document quantity limit, default 3' + default: 3 + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: remote_url, local_file, one must be selected' + description: 'Document settings. Currently only supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub' image: type: object properties: @@ -643,8 +665,65 @@ paths: enum: - remote_url - local_file - description: 'Transfer method list, remote_url, local_file, one must be selected' + description: 'Transfer method list: remote_url, local_file, one must be selected' description: 'Image settings. Currently only supports image types: png, jpg, jpeg, webp, gif' + audio: + type: object + properties: + enabled: + type: boolean + description: Whether to enable + number_limits: + type: integer + description: 'Audio quantity limit, default 3' + default: 3 + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: remote_url, local_file, one must be selected' + description: 'Audio settings. Currently only supports audio types: mp3, m4a, wav, webm, amr' + video: + type: object + properties: + enabled: + type: boolean + description: Whether to enable + number_limits: + type: integer + description: 'Video quantity limit, default 3' + default: 3 + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: remote_url, local_file, one must be selected' + description: 'Video settings. Currently only supports video types: mp4, mov, mpeg, mpga' + custom: + type: object + properties: + enabled: + type: boolean + description: Whether to enable + number_limits: + type: integer + description: 'Custom quantity limit, default 3' + default: 3 + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: remote_url, local_file, one must be selected' + description: Custom settings description: File upload configuration system_parameters: type: object diff --git a/schema/app_advanced_chat.zh.yaml b/schema/app_advanced_chat.zh.yaml index f3572fe..1d37496 100644 --- a/schema/app_advanced_chat.zh.yaml +++ b/schema/app_advanced_chat.zh.yaml @@ -6,8 +6,8 @@ info: 对话应用支持会话持久化,可将之前的聊天记录作为上下文进行回答,可适用于聊天/客服 AI 等。 所有 API 请求都需要在 Authorization HTTP Header 中包含应用级 API-Key。 强烈建议开发者把 API-Key 放在后端存储,而非分享或者放在客户端存储,以免 API-Key 泄露,导致财产损失。 - 官方原始文档见: https://github.com/langgenius/dify/blob/1.6.0/web/app/components/develop/template/template_advanced_chat.zh.mdx - version: 1.6.0 + 官方原始文档见: https://github.com/langgenius/dify/blob/1.7.0/web/app/components/develop/template/template_advanced_chat.zh.mdx + version: 1.7.0 servers: - url: https://api.dify.ai/v1 @@ -358,6 +358,9 @@ paths: type: boolean description: (选填)自动生成标题,默认 `true`。 若设置为 `false`,则可通过调用会话重命名接口并设置 `auto_generate` 为 `true` 实现异步生成标题。 default: true + trace_id: + type: string + description: (选填)链路追踪ID。适用于与业务系统已有的trace组件打通,实现端到端分布式追踪等场景。如果未指定,系统会自动生成trace_id。支持以下三种方式传递,具体优先级依次为:Header:通过 HTTP Header X-Trace-Id 传递,优先级最高。Query 参数:通过 URL 查询参数 trace_id 传递。Request Body:通过请求体字段 trace_id 传递(即本字段)。 x-fern-streaming: format: sse # FIXME: @l8ng fern 暂时不支持 @@ -637,23 +640,91 @@ paths: file_upload: type: object properties: + document: + type: object + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 文档数量限制,默认为 3 + default: 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:remote_url, local_file,必须选择一个 + description: 文档设置 当前仅支持文档类型:txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub image: type: object properties: enabled: type: boolean - description: 是否开启 + description: 是否启用 number_limits: type: integer - description: 图片数量限制,默认 3 + description: 图片数量限制,默认为 3 default: 3 transfer_methods: type: array items: type: string enum: [remote_url, local_file] - description: 传递方式列表,remote_url, local_file,必选一个 + description: 传输方式列表:remote_url, local_file,必须选择一个 description: 图片设置 当前仅支持图片类型:png, jpg, jpeg, webp, gif + audio: + type: object + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 音频数量限制,默认为 3 + default: 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:remote_url, local_file,必须选择一个 + description: 音频设置 当前仅支持音频类型:mp3, m4a, wav, webm, amr + video: + type: object + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 视频数量限制,默认为 3 + default: 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:remote_url, local_file,必须选择一个 + description: 视频设置 当前仅支持视频类型:mp4, mov, mpeg, mpga + custom: + type: object + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 自定义数量限制,默认为 3 + default: 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:remote_url, local_file,必须选择一个 + description: 自定义设置 description: 文件上传配置 system_parameters: type: object diff --git a/schema/app_chat.en.yaml b/schema/app_chat.en.yaml index a916ec8..819d09d 100644 --- a/schema/app_chat.en.yaml +++ b/schema/app_chat.en.yaml @@ -5,8 +5,8 @@ info: Dify API provides a series of interfaces for conversation functionality. It supports conversational applications. All API requests require an application-level API-Key in the Authorization HTTP Header. - official raw document: https://github.com/langgenius/dify/blob/1.4.3/web/app/components/develop/template/template_chat.en.mdx - version: 1.6.0 + official raw document: https://github.com/langgenius/dify/blob/1.7.0/web/app/components/develop/template/template_chat.en.mdx + version: 1.7.0 servers: - url: 'https://api.dify.ai/v1' description: Dify API Server @@ -478,6 +478,13 @@ paths: type: boolean description: '(Optional) Whether to automatically generate title, default is true. If set to false, you can call the conversation rename interface and set auto_generate to true to generate a title asynchronously.' default: true + trace_id: + type: string + description: | + (Optional) Trace ID for linking with existing trace components in business systems, enabling end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods, in order of priority: + - Header: Passed through HTTP Header X-Trace-Id, highest priority. + - Query parameter: Passed through URL query parameter trace_id. + - Request Body: Passed through request body field trace_id (this field). responses: '200': description: Successful response @@ -1263,6 +1270,102 @@ paths: file_upload: type: object description: File upload configuration + properties: + document: + type: object + description: 'Document settings. Currently supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub.' + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Document quantity limit, default is 3' + default: 3 + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: remote_url, local_file, must choose one.' + image: + type: object + description: 'Image settings. Currently supports image types: png, jpg, jpeg, webp, gif.' + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Image quantity limit, default is 3' + default: 3 + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: remote_url, local_file, must choose one.' + audio: + type: object + description: 'Audio settings. Currently supports audio types: mp3, m4a, wav, webm, amr.' + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Audio quantity limit, default is 3' + default: 3 + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: remote_url, local_file, must choose one.' + video: + type: object + description: 'Video settings. Currently supports video types: mp4, mov, mpeg, mpga.' + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Video quantity limit, default is 3' + default: 3 + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: remote_url, local_file, must choose one.' + custom: + type: object + description: Custom settings + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Custom quantity limit, default is 3' + default: 3 + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: remote_url, local_file, must choose one.' system_parameters: type: object properties: diff --git a/schema/app_chat.zh.yaml b/schema/app_chat.zh.yaml index 914facd..26fd9fd 100644 --- a/schema/app_chat.zh.yaml +++ b/schema/app_chat.zh.yaml @@ -5,8 +5,8 @@ info: Dify API 提供了一系列接口用于对话功能。 支持对话型应用。 所有 API 请求都需要在 Authorization HTTP Header 中包含应用级 API-Key。 - 官方原始文档见: https://github.com/langgenius/dify/blob/1.6.0/web/app/components/develop/template/template_chat.zh.mdx - version: 1.6.0 + 官方原始文档见: https://github.com/langgenius/dify/blob/1.7.0/web/app/components/develop/template/template_chat.zh.mdx + version: 1.7.0 servers: - url: https://api.dify.ai/v1 @@ -485,6 +485,13 @@ paths: type: boolean description: (选填)自动生成标题,默认 true。若设置为 false,则可通过调用会话重命名接口并设置 auto_generate 为 true 实现异步生成标题。 default: true + trace_id: + type: string + description: | + (选填)链路追踪ID。适用于与业务系统已有的trace组件打通,实现端到端分布式追踪等场景。如果未指定,系统会自动生成trace_id。支持以下三种方式传递,具体优先级依次为: + - Header:通过 HTTP Header X-Trace-Id 传递,优先级最高。 + - Query 参数:通过 URL 查询参数 trace_id 传递。 + - Request Body:通过请求体字段 trace_id 传递(即本字段)。 responses: "200": description: 成功响应 @@ -1246,6 +1253,92 @@ paths: file_upload: type: object description: 文件上传配置 + properties: + document: + type: object + description: 文档设置。当前仅支持文档类型:txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub。 + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 文档数量限制,默认为 3 + default: 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:remote_url, local_file,必须选择一个。 + image: + type: object + description: 图片设置。当前仅支持图片类型:png, jpg, jpeg, webp, gif。 + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 图片数量限制,默认为 3 + default: 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:remote_url, local_file,必须选择一个。 + audio: + type: object + description: 音频设置。当前仅支持音频类型:mp3, m4a, wav, webm, amr。 + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 音频数量限制,默认为 3 + default: 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:remote_url, local_file,必须选择一个。 + video: + type: object + description: 视频设置。当前仅支持视频类型:mp4, mov, mpeg, mpga。 + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 视频数量限制,默认为 3 + default: 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:remote_url, local_file,必须选择一个。 + custom: + type: object + description: 自定义设置 + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 自定义数量限制,默认为 3 + default: 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:remote_url, local_file,必须选择一个。 system_parameters: type: object properties: diff --git a/schema/app_generation.en.yaml b/schema/app_generation.en.yaml index 8587501..98e34a3 100644 --- a/schema/app_generation.en.yaml +++ b/schema/app_generation.en.yaml @@ -6,7 +6,7 @@ info: It supports text generation applications. All API requests require an application-level API-Key in the Authorization HTTP Header. official raw document: https://github.com/langgenius/dify/blob/1.5.0/web/app/components/develop/template/template.en.mdx - version: 1.6.0 + version: 1.7.0 servers: - url: 'https://api.dify.ai/v1' description: Dify API Server @@ -162,8 +162,18 @@ components: type: type: string enum: + - document - image - description: 'File type, currently only supports images' + - audio + - video + - custom + description: | + File type: + - document: Document types (txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub) + - image: Image types (png, jpg, jpeg, webp, gif) + - audio: Audio types (mp3, m4a, wav, webm, amr) + - video: Video types (mp4, mov, mpeg, mpga) + - custom: Custom types transfer_method: type: string enum: @@ -172,7 +182,7 @@ components: description: Transfer method url: type: string - description: Image URL (only when transfer method is remote_url) + description: File URL (only when transfer method is remote_url) upload_file_id: type: string description: Upload file ID (only when transfer method is local_file) @@ -294,6 +304,14 @@ paths: type: array items: $ref: '#/components/schemas/FileInput' + trace_id: + type: string + description: | + (Optional) Trace ID for linking with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. + If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods with priority order: + - Header: Pass through HTTP Header X-Trace-Id, highest priority + - Query parameter: Pass through URL query parameter trace_id + - Request Body: Pass through request body field trace_id (this field) responses: '200': description: Successful response @@ -663,6 +681,26 @@ paths: file_upload: type: object properties: + document: + type: object + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Document quantity limit, default 3' + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list, must choose one' + description: | + Document settings + Currently only supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub image: type: object properties: @@ -679,8 +717,68 @@ paths: enum: - remote_url - local_file - description: Transfer method list - description: Image settings + description: 'Transfer method list, must choose one' + description: | + Image settings + Currently only supports image types: png, jpg, jpeg, webp, gif + audio: + type: object + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Audio quantity limit, default 3' + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list, must choose one' + description: | + Audio settings + Currently only supports audio types: mp3, m4a, wav, webm, amr + video: + type: object + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Video quantity limit, default 3' + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list, must choose one' + description: | + Video settings + Currently only supports video types: mp4, mov, mpeg, mpga + custom: + type: object + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Custom quantity limit, default 3' + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list, must choose one' + description: Custom settings description: File upload configuration system_parameters: type: object diff --git a/schema/app_generation.zh.yaml b/schema/app_generation.zh.yaml index e06f4c5..c69ac4f 100644 --- a/schema/app_generation.zh.yaml +++ b/schema/app_generation.zh.yaml @@ -5,8 +5,8 @@ info: Dify API 提供了一系列接口用于文本生成功能。 支持文本生成型应用。 所有 API 请求都需要在 Authorization HTTP Header 中包含应用级 API-Key。 - 官方原始文档见: https://github.com/langgenius/dify/blob/1.6.0/web/app/components/develop/template/template.zh.mdx - version: 1.6.0 + 官方原始文档见: https://github.com/langgenius/dify/blob/1.7.0/web/app/components/develop/template/template.zh.mdx + version: 1.7.0 servers: - url: https://api.dify.ai/v1 @@ -175,15 +175,21 @@ components: properties: type: type: string - enum: [image] - description: 文件类型,目前仅支持图片 + enum: [document, image, audio, video, custom] + description: | + 文件类型: + - document: 文档类型(txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub) + - image: 图片类型(png, jpg, jpeg, webp, gif) + - audio: 音频类型(mp3, m4a, wav, webm, amr) + - video: 视频类型(mp4, mov, mpeg, mpga) + - custom: 自定义类型 transfer_method: type: string enum: [remote_url, local_file] description: 传递方式 url: type: string - description: 图片地址(仅当传递方式为 remote_url 时) + description: 文件地址(仅当传递方式为 remote_url 时) upload_file_id: type: string description: 上传文件 ID(仅当传递方式为 local_file 时) @@ -308,6 +314,14 @@ paths: type: array items: $ref: "#/components/schemas/FileInput" + trace_id: + type: string + description: | + (选填)链路追踪ID。适用于与业务系统已有的trace组件打通,实现端到端分布式追踪等场景。 + 如果未指定,系统会自动生成trace_id。支持以下三种方式传递,具体优先级依次为: + - Header:通过 HTTP Header X-Trace-Id 传递,优先级最高 + - Query 参数:通过 URL 查询参数 trace_id 传递 + - Request Body:通过请求体字段 trace_id 传递(即本字段) responses: "200": description: 成功响应 @@ -680,22 +694,94 @@ paths: file_upload: type: object properties: + document: + type: object + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 文档数量限制,默认为 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表,必须选择一个 + description: | + 文档设置 + 当前仅支持文档类型:txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub image: type: object properties: enabled: type: boolean - description: 是否开启 + description: 是否启用 + number_limits: + type: integer + description: 图片数量限制,默认为 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表,必须选择一个 + description: | + 图片设置 + 当前仅支持图片类型:png, jpg, jpeg, webp, gif + audio: + type: object + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 音频数量限制,默认为 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表,必须选择一个 + description: | + 音频设置 + 当前仅支持音频类型:mp3, m4a, wav, webm, amr + video: + type: object + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 视频数量限制,默认为 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表,必须选择一个 + description: | + 视频设置 + 当前仅支持视频类型:mp4, mov, mpeg, mpga + custom: + type: object + properties: + enabled: + type: boolean + description: 是否启用 number_limits: type: integer - description: 图片数量限制,默认 3 + description: 自定义数量限制,默认为 3 transfer_methods: type: array items: type: string enum: [remote_url, local_file] - description: 传递方式列表 - description: 图片设置 + description: 传输方式列表,必须选择一个 + description: 自定义设置 description: 文件上传配置 system_parameters: type: object diff --git a/schema/app_workflow.en.yaml b/schema/app_workflow.en.yaml index 11d586c..61e4a0c 100644 --- a/schema/app_workflow.en.yaml +++ b/schema/app_workflow.en.yaml @@ -6,8 +6,8 @@ info: Workflow applications have no session support and are suitable for translation/article writing/summarization AI, etc. All API requests require an application-level API-Key in the Authorization HTTP Header. It is strongly recommended that developers store the API-Key on the backend rather than sharing or storing it on the client to prevent API-Key leakage and financial loss. - official raw document: https://github.com/langgenius/dify/blob/1.5.0/web/app/components/develop/template/template_workflow.en.mdx - version: 1.6.0 + official raw document: https://github.com/langgenius/dify/blob/1.7.0/web/app/components/develop/template/template_workflow.en.mdx + version: 1.7.0 servers: - url: 'https://api.dify.ai/v1' description: Dify API Server @@ -395,6 +395,18 @@ paths: description: | User identifier, used to define the identity of the end user, for easy retrieval and statistics. Rules defined by the developer, the user identifier must be unique within the application. API cannot access sessions created by WebApp. + files: + type: array + items: + type: object + description: Optional file list + trace_id: + type: string + description: | + Tracing ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing. If not specified, the system will automatically generate a `trace_id`. Supports the following three transmission methods, with priorities as follows: + 1. Header: Recommended to pass through HTTP Header `X-Trace-Id`, highest priority. + 2. Query parameter: Pass through URL query parameter `trace_id`. + 3. Request Body: Pass through request body field `trace_id` (this field). responses: '200': description: Successful response @@ -947,6 +959,24 @@ paths: type: object description: File upload configuration properties: + document: + type: object + description: Document settings + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Document quantity limit, default 3' + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: `remote_url`, `local_file`, must choose one' image: type: object description: Image settings @@ -964,7 +994,61 @@ paths: enum: - remote_url - local_file - description: Transfer method list + description: 'Transfer method list: `remote_url`, `local_file`, must choose one' + audio: + type: object + description: Audio settings + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Audio quantity limit, default 3' + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: `remote_url`, `local_file`, must choose one' + video: + type: object + description: Video settings + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Video quantity limit, default 3' + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: `remote_url`, `local_file`, must choose one' + custom: + type: object + description: Custom settings + properties: + enabled: + type: boolean + description: Whether enabled + number_limits: + type: integer + description: 'Custom quantity limit, default 3' + transfer_methods: + type: array + items: + type: string + enum: + - remote_url + - local_file + description: 'Transfer method list: `remote_url`, `local_file`, must choose one' system_parameters: type: object description: System parameters diff --git a/schema/app_workflow.zh.yaml b/schema/app_workflow.zh.yaml index 080719e..e4268d2 100644 --- a/schema/app_workflow.zh.yaml +++ b/schema/app_workflow.zh.yaml @@ -6,8 +6,8 @@ info: Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等等。 所有 API 请求都需要在 Authorization HTTP Header 中包含应用级 API-Key。 强烈建议开发者把 API-Key 放在后端存储,而非分享或者放在客户端存储,以免 API-Key 泄露,导致财产损失。 - 官方原始文档见: https://github.com/langgenius/dify/blob/1.6.0/web/app/components/develop/template/template_workflow.zh.mdx - version: 1.6.0 + 官方原始文档见: https://github.com/langgenius/dify/blob/1.7.0/web/app/components/develop/template/template_workflow.zh.mdx + version: 1.7.0 servers: - url: https://api.dify.ai/v1 @@ -405,6 +405,18 @@ paths: description: | 用户标识,用于定义终端用户的身份,方便检索、统计。 由开发者定义规则,需保证用户标识在应用内唯一。API 无法访问 WebApp 创建的会话。 + files: + type: array + items: + type: object + description: 可选文件列表 + trace_id: + type: string + description: | + 链路追踪ID。适用于与业务系统已有的trace组件打通,实现端到端分布式追踪等场景。如果未指定,系统将自动生成 `trace_id`。支持以下三种方式传递,具体优先级依次为: + 1. Header:推荐通过 HTTP Header `X-Trace-Id` 传递,优先级最高。 + 2. Query 参数:通过 URL 查询参数 `trace_id` 传递。 + 3. Request Body:通过请求体字段 `trace_id` 传递(即本字段)。 responses: "200": @@ -958,22 +970,86 @@ paths: type: object description: 文件上传配置 properties: + document: + type: object + description: 文档设置 + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 文档数量限制,默认为 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:`remote_url`, `local_file`,必须选择一个 image: type: object description: 图片设置 properties: enabled: type: boolean - description: 是否开启 + description: 是否启用 + number_limits: + type: integer + description: 图片数量限制,默认为 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:`remote_url`, `local_file`,必须选择一个 + audio: + type: object + description: 音频设置 + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 音频数量限制,默认为 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:`remote_url`, `local_file`,必须选择一个 + video: + type: object + description: 视频设置 + properties: + enabled: + type: boolean + description: 是否启用 + number_limits: + type: integer + description: 视频数量限制,默认为 3 + transfer_methods: + type: array + items: + type: string + enum: [remote_url, local_file] + description: 传输方式列表:`remote_url`, `local_file`,必须选择一个 + custom: + type: object + description: 自定义设置 + properties: + enabled: + type: boolean + description: 是否启用 number_limits: type: integer - description: 图片数量限制,默认 3 + description: 自定义数量限制,默认为 3 transfer_methods: type: array items: type: string enum: [remote_url, local_file] - description: 传递方式列表 + description: 传输方式列表:`remote_url`, `local_file`,必须选择一个 system_parameters: type: object description: 系统参数 diff --git a/schema/knowledge_base.en.yaml b/schema/knowledge_base.en.yaml index f9dada3..9d3eef3 100644 --- a/schema/knowledge_base.en.yaml +++ b/schema/knowledge_base.en.yaml @@ -4,7 +4,7 @@ info: description: | Dify Knowledge Base API provides a series of interfaces for managing knowledge bases, documents, and retrieval functions. All API requests require a knowledge base level API-Key in the Authorization HTTP Header. - version: 1.6.0 + version: 1.7.0 servers: - url: 'https://api.dify.ai/v1' description: Dify API Server @@ -298,6 +298,15 @@ components: reranking_enable: type: boolean description: Whether reranking is enabled (optional). Required if search mode is semantic_search or hybrid_search + reranking_mode: + type: string + enum: + - weighted_score + - reranking_model + description: | + Rerank mode + - weighted_score: Weight setting + - reranking_model: Rerank model reranking_model: type: object properties: @@ -383,6 +392,7 @@ components: enum: - automatic - custom + - hierarchical description: Cleaning and segmentation mode rules: type: object @@ -416,6 +426,28 @@ components: chunk_overlap: type: integer description: Segment overlap + parent_mode: + type: string + enum: + - full-doc + - paragraph + description: | + Parent segment recall mode + - full-doc: Full document recall + - paragraph: Paragraph recall + subchunk_segmentation: + type: object + description: Sub-chunk segmentation rules + properties: + separator: + type: string + description: 'Segmentation identifier, only one separator is allowed. Default is ***' + max_tokens: + type: integer + description: 'Maximum length (tokens), must be less than parent level' + chunk_overlap: + type: integer + description: Segment overlap refers to a certain overlap between segments when segmenting data (optional) description: Custom rules (empty for automatic mode) Document: type: object @@ -940,17 +972,24 @@ components: enum: - high_quality - economy - description: Indexing technique + description: | + Indexing technique + - high_quality: High quality: Use Embedding model for embedding, build as vector database index + - economy: Economy: Build using keyword table index inverted index doc_form: type: string enum: - text_model - hierarchical_model - qa_model - description: Document form + description: | + Document form + - text_model: Direct text document embedding, default mode for economy + - hierarchical_model: Parent-child mode + - qa_model: Q&A mode: Generate Q&A pairs for segmented documents, then embed questions doc_language: type: string - description: Document language (required for Q&A mode) + description: 'In Q&A mode, specify the document language, e.g.: English, Chinese' process_rule: $ref: '#/components/schemas/ProcessRule' description: Processing rules @@ -1309,8 +1348,7 @@ paths: type: string description: Embedding model (optional) retrieval_model: - type: string - description: Retrieval model (optional) + $ref: '#/components/schemas/RetrievalModel' partial_member_list: type: array description: Partial team members ID list (optional) diff --git a/schema/knowledge_base.zh.yaml b/schema/knowledge_base.zh.yaml index 0dccc11..37de090 100644 --- a/schema/knowledge_base.zh.yaml +++ b/schema/knowledge_base.zh.yaml @@ -4,7 +4,7 @@ info: description: | Dify 知识库 API 提供了一系列接口用于管理知识库、文档和检索功能。 所有 API 请求都需要在 Authorization HTTP Header 中包含知识库级 API-Key。 - version: 1.6.0 + version: 1.7.0 servers: - url: https://api.dify.ai/v1 @@ -291,6 +291,13 @@ components: reranking_enable: type: boolean description: 是否启用 Reranking,非必填,如果检索模式为 semantic_search 模式或者 hybrid_search 则传值 + reranking_mode: + type: string + enum: [weighted_score, reranking_model] + description: | + Rerank 模式 + - weighted_score: 权重设置 + - reranking_model: Rerank 模型 reranking_model: type: object properties: @@ -375,11 +382,12 @@ components: properties: mode: type: string - enum: [automatic, custom] + enum: [automatic, custom, hierarchical] description: | 清洗、分段模式 - automatic: 自动 - custom: 自定义 + - hierarchical: 父子 rules: type: object properties: @@ -411,6 +419,26 @@ components: chunk_overlap: type: integer description: 分段重叠 + parent_mode: + type: string + enum: [full-doc, paragraph] + description: | + 父分段的召回模式 + - full-doc: 全文召回 + - paragraph: 段落召回 + subchunk_segmentation: + type: object + description: 子分段规则 + properties: + separator: + type: string + description: 分段标识符,目前仅允许设置一个分隔符。默认为 *** + max_tokens: + type: integer + description: 最大长度 (token) 需要校验小于父级的长度 + chunk_overlap: + type: integer + description: 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填) Document: type: object @@ -916,14 +944,21 @@ components: indexing_technique: type: string enum: [high_quality, economy] - description: 索引方式 + description: | + 索引方式 + - high_quality: 高质量:使用 Embedding 模型进行嵌入,构建为向量数据库索引 + - economy: 经济:使用 keyword table index 的倒排索引进行构建 doc_form: type: string enum: [text_model, hierarchical_model, qa_model] - description: 索引内容形式 + description: | + 索引内容形式 + - text_model: text 文档直接 embedding,经济模式默认为该模式 + - hierarchical_model: parent-child 模式 + - qa_model: Q&A 模式:为分片文档生成 Q&A 对,然后对问题进行 embedding doc_language: type: string - description: 文档语言(Q&A模式必填) + description: 在 Q&A 模式下,指定文档的语言,例如:English、Chinese process_rule: $ref: "#/components/schemas/ProcessRule" retrieval_model: @@ -1285,8 +1320,7 @@ paths: type: string description: 嵌入模型(选填) retrieval_model: - type: string - description: 检索模型(选填) + $ref: "#/components/schemas/RetrievalModel" partial_member_list: type: array description: 部分团队成员 ID 列表(选填) diff --git a/schema/overlays/app_advanced_chat.en.overlay.yaml b/schema/overlays/app_advanced_chat.en.overlay.yaml index 708af01..bf811ca 100644 --- a/schema/overlays/app_advanced_chat.en.overlay.yaml +++ b/schema/overlays/app_advanced_chat.en.overlay.yaml @@ -1,7 +1,7 @@ overlay: 1.0.0 info: title: "English translation overlay for Dify API - Advanced Chat Application" - version: "1.4.3" + version: "1.7.0" extends: ../app_advanced_chat.zh.yaml actions: - target: $.info @@ -12,7 +12,7 @@ actions: Chat applications support session persistence, allowing previous chat history to be used as context for responses, suitable for chat/customer service AI, etc. All API requests require an application-level API-Key in the Authorization HTTP Header. It is strongly recommended that developers store the API-Key on the backend rather than sharing or storing it on the client side to prevent API-Key leakage and financial loss. - official raw document: https://github.com/langgenius/dify/blob/1.4.3/web/app/components/develop/template/template_advanced_chat.en.mdx + official raw document: https://github.com/langgenius/dify/blob/1.7.0/web/app/components/develop/template/template_advanced_chat.en.mdx - target: $.servers[0] update: @@ -267,6 +267,10 @@ actions: update: description: "(Optional) Automatically generate title, default `true`. If set to `false`, you can call the conversation rename interface and set `auto_generate` to `true` to generate a title asynchronously." + - target: $.paths['/chat-messages'].post.requestBody.content['application/json'].schema.properties.trace_id + update: + description: "(Optional) Trace ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Three methods are supported with the following priority order: Header: Pass through HTTP Header X-Trace-Id, highest priority. Query parameter: Pass through URL query parameter trace_id. Request Body: Pass through request body field trace_id (this field)." + - target: $.paths['/chat-messages'].post.responses['200'].description update: "Successful response" @@ -431,6 +435,18 @@ actions: - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.description update: "File upload configuration" + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.description + update: "Document settings. Currently only supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.properties.enabled.description + update: "Whether to enable" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.properties.number_limits.description + update: "Document quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.properties.transfer_methods.description + update: "Transfer method list: remote_url, local_file, one must be selected" + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.image.description update: "Image settings. Currently only supports image types: png, jpg, jpeg, webp, gif" @@ -441,7 +457,43 @@ actions: update: "Image quantity limit, default 3" - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.image.properties.transfer_methods.description - update: "Transfer method list, remote_url, local_file, one must be selected" + update: "Transfer method list: remote_url, local_file, one must be selected" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.description + update: "Audio settings. Currently only supports audio types: mp3, m4a, wav, webm, amr" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.properties.enabled.description + update: "Whether to enable" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.properties.number_limits.description + update: "Audio quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.properties.transfer_methods.description + update: "Transfer method list: remote_url, local_file, one must be selected" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.description + update: "Video settings. Currently only supports video types: mp4, mov, mpeg, mpga" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.properties.enabled.description + update: "Whether to enable" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.properties.number_limits.description + update: "Video quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.properties.transfer_methods.description + update: "Transfer method list: remote_url, local_file, one must be selected" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.description + update: "Custom settings" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.properties.enabled.description + update: "Whether to enable" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.properties.number_limits.description + update: "Custom quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.properties.transfer_methods.description + update: "Transfer method list: remote_url, local_file, one must be selected" - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.system_parameters.description update: "System parameters" diff --git a/schema/overlays/app_chat.en.overlay.yaml b/schema/overlays/app_chat.en.overlay.yaml index bf844d3..3df21fa 100644 --- a/schema/overlays/app_chat.en.overlay.yaml +++ b/schema/overlays/app_chat.en.overlay.yaml @@ -11,7 +11,7 @@ actions: Dify API provides a series of interfaces for conversation functionality. It supports conversational applications. All API requests require an application-level API-Key in the Authorization HTTP Header. - official raw document: https://github.com/langgenius/dify/blob/1.4.3/web/app/components/develop/template/template_chat.en.mdx + official raw document: https://github.com/langgenius/dify/blob/1.7.0/web/app/components/develop/template/template_chat.en.mdx - target: $.servers[0] update: @@ -358,6 +358,14 @@ actions: update: description: "(Optional) Whether to automatically generate title, default is true. If set to false, you can call the conversation rename interface and set auto_generate to true to generate a title asynchronously." + - target: $.paths['/chat-messages'].post.requestBody.content['application/json'].schema.properties.trace_id + update: + description: | + (Optional) Trace ID for linking with existing trace components in business systems, enabling end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods, in order of priority: + - Header: Passed through HTTP Header X-Trace-Id, highest priority. + - Query parameter: Passed through URL query parameter trace_id. + - Request Body: Passed through request body field trace_id (this field). + - target: $.paths['/chat-messages'].post.responses['200'].description update: "Successful response" @@ -829,6 +837,52 @@ actions: - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload update: description: "File upload configuration" + properties: + document: + description: "Document settings. Currently supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub." + properties: + enabled: + description: "Whether enabled" + number_limits: + description: "Document quantity limit, default is 3" + transfer_methods: + description: "Transfer method list: remote_url, local_file, must choose one." + image: + description: "Image settings. Currently supports image types: png, jpg, jpeg, webp, gif." + properties: + enabled: + description: "Whether enabled" + number_limits: + description: "Image quantity limit, default is 3" + transfer_methods: + description: "Transfer method list: remote_url, local_file, must choose one." + audio: + description: "Audio settings. Currently supports audio types: mp3, m4a, wav, webm, amr." + properties: + enabled: + description: "Whether enabled" + number_limits: + description: "Audio quantity limit, default is 3" + transfer_methods: + description: "Transfer method list: remote_url, local_file, must choose one." + video: + description: "Video settings. Currently supports video types: mp4, mov, mpeg, mpga." + properties: + enabled: + description: "Whether enabled" + number_limits: + description: "Video quantity limit, default is 3" + transfer_methods: + description: "Transfer method list: remote_url, local_file, must choose one." + custom: + description: "Custom settings" + properties: + enabled: + description: "Whether enabled" + number_limits: + description: "Custom quantity limit, default is 3" + transfer_methods: + description: "Transfer method list: remote_url, local_file, must choose one." - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.system_parameters update: diff --git a/schema/overlays/app_generation.en.overlay.yaml b/schema/overlays/app_generation.en.overlay.yaml index 1f074f9..c7ddf17 100644 --- a/schema/overlays/app_generation.en.overlay.yaml +++ b/schema/overlays/app_generation.en.overlay.yaml @@ -115,13 +115,19 @@ actions: update: "Message creation timestamp" - target: $.components.schemas.FileInput.properties.type.description - update: "File type, currently only supports images" + update: | + File type: + - document: Document types (txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub) + - image: Image types (png, jpg, jpeg, webp, gif) + - audio: Audio types (mp3, m4a, wav, webm, amr) + - video: Video types (mp4, mov, mpeg, mpga) + - custom: Custom types - target: $.components.schemas.FileInput.properties.transfer_method.description update: "Transfer method" - target: $.components.schemas.FileInput.properties.url.description - update: "Image URL (only when transfer method is remote_url)" + update: "File URL (only when transfer method is remote_url)" - target: $.components.schemas.FileInput.properties.upload_file_id.description update: "Upload file ID (only when transfer method is local_file)" @@ -194,6 +200,15 @@ actions: update: description: "User identifier, used to define the identity of the end user for easy retrieval and statistics. Developer-defined rules must ensure that the user identifier is unique within the application" + - target: $.paths['/completion-messages'].post.requestBody.content['application/json'].schema.properties.trace_id + update: + description: | + (Optional) Trace ID for linking with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. + If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods with priority order: + - Header: Pass through HTTP Header X-Trace-Id, highest priority + - Query parameter: Pass through URL query parameter trace_id + - Request Body: Pass through request body field trace_id (this field) + - target: $.paths['/completion-messages'].post.responses['200'].description update: "Successful response" @@ -397,8 +412,24 @@ actions: update: description: "File upload configuration" + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.description + update: | + Document settings + Currently only supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.properties.enabled.description + update: "Whether enabled" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.properties.number_limits.description + update: "Document quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.properties.transfer_methods.description + update: "Transfer method list, must choose one" + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.image.description - update: "Image settings" + update: | + Image settings + Currently only supports image types: png, jpg, jpeg, webp, gif - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.image.properties.enabled.description update: "Whether enabled" @@ -407,7 +438,47 @@ actions: update: "Image quantity limit, default 3" - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.image.properties.transfer_methods.description - update: "Transfer method list" + update: "Transfer method list, must choose one" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.description + update: | + Audio settings + Currently only supports audio types: mp3, m4a, wav, webm, amr + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.properties.enabled.description + update: "Whether enabled" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.properties.number_limits.description + update: "Audio quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.properties.transfer_methods.description + update: "Transfer method list, must choose one" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.description + update: | + Video settings + Currently only supports video types: mp4, mov, mpeg, mpga + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.properties.enabled.description + update: "Whether enabled" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.properties.number_limits.description + update: "Video quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.properties.transfer_methods.description + update: "Transfer method list, must choose one" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.description + update: "Custom settings" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.properties.enabled.description + update: "Whether enabled" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.properties.number_limits.description + update: "Custom quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.properties.transfer_methods.description + update: "Transfer method list, must choose one" - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.system_parameters update: diff --git a/schema/overlays/app_workflow.en.overlay.yaml b/schema/overlays/app_workflow.en.overlay.yaml index 61c0f2b..d856133 100644 --- a/schema/overlays/app_workflow.en.overlay.yaml +++ b/schema/overlays/app_workflow.en.overlay.yaml @@ -745,4 +745,83 @@ actions: update: "Application mode" - target: $.paths['/info'].get.responses['200'].content['application/json'].schema.properties.author_name.description - update: "Author name" \ No newline at end of file + update: "Author name" + + # Add new overlay actions for 1.7.0 updates + - target: $.info.version + update: "1.7.0" + + - target: $.info.description + update: | + Dify API provides a series of interfaces for workflow functionality. + Workflow applications have no session support and are suitable for translation/article writing/summarization AI, etc. + All API requests require an application-level API-Key in the Authorization HTTP Header. + It is strongly recommended that developers store the API-Key on the backend rather than sharing or storing it on the client to prevent API-Key leakage and financial loss. + official raw document: https://github.com/langgenius/dify/blob/1.7.0/web/app/components/develop/template/template_workflow.en.mdx + + - target: $.paths['/workflows/run'].post.requestBody.content['application/json'].schema.properties.files.description + update: "Optional file list" + + - target: $.paths['/workflows/run'].post.requestBody.content['application/json'].schema.properties.trace_id.description + update: | + Tracing ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing. If not specified, the system will automatically generate a `trace_id`. Supports the following three transmission methods, with priorities as follows: + 1. Header: Recommended to pass through HTTP Header `X-Trace-Id`, highest priority. + 2. Query parameter: Pass through URL query parameter `trace_id`. + 3. Request Body: Pass through request body field `trace_id` (this field). + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.description + update: "Document settings" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.properties.enabled.description + update: "Whether enabled" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.properties.number_limits.description + update: "Document quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.document.properties.transfer_methods.description + update: "Transfer method list: `remote_url`, `local_file`, must choose one" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.image.properties.enabled.description + update: "Whether enabled" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.image.properties.number_limits.description + update: "Image quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.image.properties.transfer_methods.description + update: "Transfer method list: `remote_url`, `local_file`, must choose one" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.description + update: "Audio settings" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.properties.enabled.description + update: "Whether enabled" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.properties.number_limits.description + update: "Audio quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.audio.properties.transfer_methods.description + update: "Transfer method list: `remote_url`, `local_file`, must choose one" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.description + update: "Video settings" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.properties.enabled.description + update: "Whether enabled" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.properties.number_limits.description + update: "Video quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.video.properties.transfer_methods.description + update: "Transfer method list: `remote_url`, `local_file`, must choose one" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.description + update: "Custom settings" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.properties.enabled.description + update: "Whether enabled" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.properties.number_limits.description + update: "Custom quantity limit, default 3" + + - target: $.paths['/parameters'].get.responses['200'].content['application/json'].schema.properties.file_upload.properties.custom.properties.transfer_methods.description + update: "Transfer method list: `remote_url`, `local_file`, must choose one" \ No newline at end of file diff --git a/schema/overlays/knowledge_base.en.overlay.yaml b/schema/overlays/knowledge_base.en.overlay.yaml index 85ff949..f142d52 100644 --- a/schema/overlays/knowledge_base.en.overlay.yaml +++ b/schema/overlays/knowledge_base.en.overlay.yaml @@ -1,7 +1,7 @@ overlay: 1.0.0 info: title: "English translation overlay for Dify Knowledge Base API" - version: "1.4.0" + version: "1.7.0" extends: ../knowledge_base.zh.yaml actions: - target: $.info @@ -266,6 +266,13 @@ actions: update: description: "Whether reranking is enabled (optional). Required if search mode is semantic_search or hybrid_search" + - target: $.components.schemas.RetrievalModel.properties.reranking_mode + update: + description: | + Rerank mode + - weighted_score: Weight setting + - reranking_model: Rerank model + - target: $.components.schemas.RetrievalModel.properties.reranking_model update: description: "Rerank model configuration (optional). Required if reranking is enabled" @@ -334,6 +341,32 @@ actions: update: description: "Maximum length (tokens)" + - target: $.components.schemas.ProcessRule.properties.rules.properties.segmentation.properties.chunk_overlap + update: + description: "Segment overlap" + + - target: $.components.schemas.ProcessRule.properties.rules.properties.parent_mode + update: + description: | + Parent segment recall mode + - full-doc: Full document recall + - paragraph: Paragraph recall + + - target: $.components.schemas.ProcessRule.properties.rules.properties.subchunk_segmentation + update: + description: "Sub-chunk segmentation rules" + + - target: $.components.schemas.ProcessRule.properties.rules.properties.subchunk_segmentation.properties.separator + update: + description: "Segmentation identifier, only one separator is allowed. Default is ***" + + - target: $.components.schemas.ProcessRule.properties.rules.properties.subchunk_segmentation.properties.max_tokens + update: + description: "Maximum length (tokens), must be less than parent level" + + - target: $.components.schemas.ProcessRule.properties.rules.properties.subchunk_segmentation.properties.chunk_overlap + update: + description: "Segment overlap refers to a certain overlap between segments when segmenting data (optional)" - target: $.components.schemas.ProcessRule.properties.rules.properties.pre_processing_rules.items.properties.name update: @@ -535,15 +568,22 @@ actions: - target: $.components.schemas.CreateDocumentByFileRequestData.properties.indexing_technique update: - description: "Indexing technique" + description: | + Indexing technique + - high_quality: High quality: Use Embedding model for embedding, build as vector database index + - economy: Economy: Build using keyword table index inverted index - target: $.components.schemas.CreateDocumentByFileRequestData.properties.doc_form update: - description: "Document form" + description: | + Document form + - text_model: Direct text document embedding, default mode for economy + - hierarchical_model: Parent-child mode + - qa_model: Q&A mode: Generate Q&A pairs for segmented documents, then embed questions - target: $.components.schemas.CreateDocumentByFileRequestData.properties.doc_language update: - description: "Document language (required for Q&A mode)" + description: "In Q&A mode, specify the document language, e.g.: English, Chinese" - target: $.components.schemas.CreateDocumentByFileRequestData.properties.process_rule update: @@ -612,8 +652,7 @@ actions: - target: $.paths['/datasets/{dataset_id}'].patch.requestBody.content['application/json'].schema.properties.embedding_model.description update: "Embedding model (optional)" - - target: $.paths['/datasets/{dataset_id}'].patch.requestBody.content['application/json'].schema.properties.retrieval_model.description - update: "Retrieval model (optional)" + - target: $.paths['/datasets/{dataset_id}'].patch.requestBody.content['application/json'].schema.properties.partial_member_list.description update: "Partial team members ID list (optional)" diff --git a/src/dify_sdk/advanced_chat/__init__.py b/src/dify_sdk/advanced_chat/__init__.py index 17d3b5d..e16ef28 100644 --- a/src/dify_sdk/advanced_chat/__init__.py +++ b/src/dify_sdk/advanced_chat/__init__.py @@ -32,8 +32,16 @@ GetApplicationParametersByAppAdvancedChatResponse, GetApplicationParametersByAppAdvancedChatResponseAnnotationReply, GetApplicationParametersByAppAdvancedChatResponseFileUpload, + GetApplicationParametersByAppAdvancedChatResponseFileUploadAudio, + GetApplicationParametersByAppAdvancedChatResponseFileUploadAudioTransferMethodsItem, + GetApplicationParametersByAppAdvancedChatResponseFileUploadCustom, + GetApplicationParametersByAppAdvancedChatResponseFileUploadCustomTransferMethodsItem, + GetApplicationParametersByAppAdvancedChatResponseFileUploadDocument, + GetApplicationParametersByAppAdvancedChatResponseFileUploadDocumentTransferMethodsItem, GetApplicationParametersByAppAdvancedChatResponseFileUploadImage, GetApplicationParametersByAppAdvancedChatResponseFileUploadImageTransferMethodsItem, + GetApplicationParametersByAppAdvancedChatResponseFileUploadVideo, + GetApplicationParametersByAppAdvancedChatResponseFileUploadVideoTransferMethodsItem, GetApplicationParametersByAppAdvancedChatResponseRetrieverResource, GetApplicationParametersByAppAdvancedChatResponseSpeechToText, GetApplicationParametersByAppAdvancedChatResponseSuggestedQuestionsAfterAnswer, @@ -103,8 +111,16 @@ "GetApplicationParametersByAppAdvancedChatResponse", "GetApplicationParametersByAppAdvancedChatResponseAnnotationReply", "GetApplicationParametersByAppAdvancedChatResponseFileUpload", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadAudio", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadAudioTransferMethodsItem", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadCustom", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadCustomTransferMethodsItem", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadDocument", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadDocumentTransferMethodsItem", "GetApplicationParametersByAppAdvancedChatResponseFileUploadImage", "GetApplicationParametersByAppAdvancedChatResponseFileUploadImageTransferMethodsItem", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadVideo", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadVideoTransferMethodsItem", "GetApplicationParametersByAppAdvancedChatResponseRetrieverResource", "GetApplicationParametersByAppAdvancedChatResponseSpeechToText", "GetApplicationParametersByAppAdvancedChatResponseSuggestedQuestionsAfterAnswer", diff --git a/src/dify_sdk/advanced_chat/client.py b/src/dify_sdk/advanced_chat/client.py index 88d2687..0881cf2 100644 --- a/src/dify_sdk/advanced_chat/client.py +++ b/src/dify_sdk/advanced_chat/client.py @@ -77,6 +77,7 @@ def send_chat_message_by_app_advanced_chat( conversation_id: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[FileInput]] = OMIT, auto_generate_name: typing.Optional[bool] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[ChunkChatCompletionResponse]: """ @@ -107,6 +108,9 @@ def send_chat_message_by_app_advanced_chat( auto_generate_name : typing.Optional[bool] (Optional) Automatically generate title, default `true`. If set to `false`, you can call the conversation rename interface and set `auto_generate` to `true` to generate a title asynchronously. + trace_id : typing.Optional[str] + (Optional) Trace ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Three methods are supported with the following priority order: Header: Pass through HTTP Header X-Trace-Id, highest priority. Query parameter: Pass through URL query parameter trace_id. Request Body: Pass through request body field trace_id (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -131,6 +135,7 @@ def send_chat_message_by_app_advanced_chat( conversation_id=conversation_id, files=files, auto_generate_name=auto_generate_name, + trace_id=trace_id, request_options=request_options, ) as r: yield from r.data @@ -958,6 +963,7 @@ async def send_chat_message_by_app_advanced_chat( conversation_id: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[FileInput]] = OMIT, auto_generate_name: typing.Optional[bool] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[ChunkChatCompletionResponse]: """ @@ -988,6 +994,9 @@ async def send_chat_message_by_app_advanced_chat( auto_generate_name : typing.Optional[bool] (Optional) Automatically generate title, default `true`. If set to `false`, you can call the conversation rename interface and set `auto_generate` to `true` to generate a title asynchronously. + trace_id : typing.Optional[str] + (Optional) Trace ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Three methods are supported with the following priority order: Header: Pass through HTTP Header X-Trace-Id, highest priority. Query parameter: Pass through URL query parameter trace_id. Request Body: Pass through request body field trace_id (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1015,6 +1024,7 @@ async def main() -> None: conversation_id=conversation_id, files=files, auto_generate_name=auto_generate_name, + trace_id=trace_id, request_options=request_options, ) as r: async for data in r.data: diff --git a/src/dify_sdk/advanced_chat/raw_client.py b/src/dify_sdk/advanced_chat/raw_client.py index f96c75b..58ee2a1 100644 --- a/src/dify_sdk/advanced_chat/raw_client.py +++ b/src/dify_sdk/advanced_chat/raw_client.py @@ -81,6 +81,7 @@ def send_chat_message_by_app_advanced_chat( conversation_id: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[FileInput]] = OMIT, auto_generate_name: typing.Optional[bool] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[HttpResponse[typing.Iterator[ChunkChatCompletionResponse]]]: """ @@ -111,6 +112,9 @@ def send_chat_message_by_app_advanced_chat( auto_generate_name : typing.Optional[bool] (Optional) Automatically generate title, default `true`. If set to `false`, you can call the conversation rename interface and set `auto_generate` to `true` to generate a title asynchronously. + trace_id : typing.Optional[str] + (Optional) Trace ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Three methods are supported with the following priority order: Header: Pass through HTTP Header X-Trace-Id, highest priority. Query parameter: Pass through URL query parameter trace_id. Request Body: Pass through request body field trace_id (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -132,6 +136,7 @@ def send_chat_message_by_app_advanced_chat( object_=files, annotation=typing.Sequence[FileInput], direction="write" ), "auto_generate_name": auto_generate_name, + "trace_id": trace_id, }, headers={ "content-type": "application/json", @@ -1367,6 +1372,7 @@ async def send_chat_message_by_app_advanced_chat( conversation_id: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[FileInput]] = OMIT, auto_generate_name: typing.Optional[bool] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[ChunkChatCompletionResponse]]]: """ @@ -1397,6 +1403,9 @@ async def send_chat_message_by_app_advanced_chat( auto_generate_name : typing.Optional[bool] (Optional) Automatically generate title, default `true`. If set to `false`, you can call the conversation rename interface and set `auto_generate` to `true` to generate a title asynchronously. + trace_id : typing.Optional[str] + (Optional) Trace ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Three methods are supported with the following priority order: Header: Pass through HTTP Header X-Trace-Id, highest priority. Query parameter: Pass through URL query parameter trace_id. Request Body: Pass through request body field trace_id (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1418,6 +1427,7 @@ async def send_chat_message_by_app_advanced_chat( object_=files, annotation=typing.Sequence[FileInput], direction="write" ), "auto_generate_name": auto_generate_name, + "trace_id": trace_id, }, headers={ "content-type": "application/json", diff --git a/src/dify_sdk/advanced_chat/types/__init__.py b/src/dify_sdk/advanced_chat/types/__init__.py index fcd54e6..67e5e40 100644 --- a/src/dify_sdk/advanced_chat/types/__init__.py +++ b/src/dify_sdk/advanced_chat/types/__init__.py @@ -49,12 +49,36 @@ from .get_application_parameters_by_app_advanced_chat_response_file_upload import ( GetApplicationParametersByAppAdvancedChatResponseFileUpload, ) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_audio import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadAudio, +) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_audio_transfer_methods_item import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadAudioTransferMethodsItem, +) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_custom import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadCustom, +) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_custom_transfer_methods_item import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadCustomTransferMethodsItem, +) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_document import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadDocument, +) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_document_transfer_methods_item import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadDocumentTransferMethodsItem, +) from .get_application_parameters_by_app_advanced_chat_response_file_upload_image import ( GetApplicationParametersByAppAdvancedChatResponseFileUploadImage, ) from .get_application_parameters_by_app_advanced_chat_response_file_upload_image_transfer_methods_item import ( GetApplicationParametersByAppAdvancedChatResponseFileUploadImageTransferMethodsItem, ) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_video import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadVideo, +) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_video_transfer_methods_item import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadVideoTransferMethodsItem, +) from .get_application_parameters_by_app_advanced_chat_response_retriever_resource import ( GetApplicationParametersByAppAdvancedChatResponseRetrieverResource, ) @@ -139,8 +163,16 @@ "GetApplicationParametersByAppAdvancedChatResponse", "GetApplicationParametersByAppAdvancedChatResponseAnnotationReply", "GetApplicationParametersByAppAdvancedChatResponseFileUpload", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadAudio", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadAudioTransferMethodsItem", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadCustom", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadCustomTransferMethodsItem", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadDocument", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadDocumentTransferMethodsItem", "GetApplicationParametersByAppAdvancedChatResponseFileUploadImage", "GetApplicationParametersByAppAdvancedChatResponseFileUploadImageTransferMethodsItem", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadVideo", + "GetApplicationParametersByAppAdvancedChatResponseFileUploadVideoTransferMethodsItem", "GetApplicationParametersByAppAdvancedChatResponseRetrieverResource", "GetApplicationParametersByAppAdvancedChatResponseSpeechToText", "GetApplicationParametersByAppAdvancedChatResponseSuggestedQuestionsAfterAnswer", diff --git a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload.py b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload.py index 16d3c11..41d463c 100644 --- a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload.py +++ b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload.py @@ -4,9 +4,21 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_advanced_chat_response_file_upload_audio import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadAudio, +) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_custom import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadCustom, +) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_document import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadDocument, +) from .get_application_parameters_by_app_advanced_chat_response_file_upload_image import ( GetApplicationParametersByAppAdvancedChatResponseFileUploadImage, ) +from .get_application_parameters_by_app_advanced_chat_response_file_upload_video import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadVideo, +) class GetApplicationParametersByAppAdvancedChatResponseFileUpload(UniversalBaseModel): @@ -14,6 +26,13 @@ class GetApplicationParametersByAppAdvancedChatResponseFileUpload(UniversalBaseM File upload configuration """ + document: typing.Optional[GetApplicationParametersByAppAdvancedChatResponseFileUploadDocument] = pydantic.Field( + default=None + ) + """ + Document settings. Currently only supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub + """ + image: typing.Optional[GetApplicationParametersByAppAdvancedChatResponseFileUploadImage] = pydantic.Field( default=None ) @@ -21,6 +40,27 @@ class GetApplicationParametersByAppAdvancedChatResponseFileUpload(UniversalBaseM Image settings. Currently only supports image types: png, jpg, jpeg, webp, gif """ + audio: typing.Optional[GetApplicationParametersByAppAdvancedChatResponseFileUploadAudio] = pydantic.Field( + default=None + ) + """ + Audio settings. Currently only supports audio types: mp3, m4a, wav, webm, amr + """ + + video: typing.Optional[GetApplicationParametersByAppAdvancedChatResponseFileUploadVideo] = pydantic.Field( + default=None + ) + """ + Video settings. Currently only supports video types: mp4, mov, mpeg, mpga + """ + + custom: typing.Optional[GetApplicationParametersByAppAdvancedChatResponseFileUploadCustom] = pydantic.Field( + default=None + ) + """ + Custom settings + """ + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: diff --git a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_audio.py b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_audio.py new file mode 100644 index 0000000..ea2f79f --- /dev/null +++ b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_audio.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_advanced_chat_response_file_upload_audio_transfer_methods_item import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadAudioTransferMethodsItem, +) + + +class GetApplicationParametersByAppAdvancedChatResponseFileUploadAudio(UniversalBaseModel): + """ + Audio settings. Currently only supports audio types: mp3, m4a, wav, webm, amr + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Audio quantity limit, default 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppAdvancedChatResponseFileUploadAudioTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list: remote_url, local_file, one must be selected + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_audio_transfer_methods_item.py b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_audio_transfer_methods_item.py new file mode 100644 index 0000000..66f4b57 --- /dev/null +++ b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_audio_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppAdvancedChatResponseFileUploadAudioTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_custom.py b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_custom.py new file mode 100644 index 0000000..65d3320 --- /dev/null +++ b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_custom.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_advanced_chat_response_file_upload_custom_transfer_methods_item import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadCustomTransferMethodsItem, +) + + +class GetApplicationParametersByAppAdvancedChatResponseFileUploadCustom(UniversalBaseModel): + """ + Custom settings + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Custom quantity limit, default 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppAdvancedChatResponseFileUploadCustomTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list: remote_url, local_file, one must be selected + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_custom_transfer_methods_item.py b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_custom_transfer_methods_item.py new file mode 100644 index 0000000..b6fbcf9 --- /dev/null +++ b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_custom_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppAdvancedChatResponseFileUploadCustomTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_document.py b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_document.py new file mode 100644 index 0000000..c8aaed8 --- /dev/null +++ b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_document.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_advanced_chat_response_file_upload_document_transfer_methods_item import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadDocumentTransferMethodsItem, +) + + +class GetApplicationParametersByAppAdvancedChatResponseFileUploadDocument(UniversalBaseModel): + """ + Document settings. Currently only supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Document quantity limit, default 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppAdvancedChatResponseFileUploadDocumentTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list: remote_url, local_file, one must be selected + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_document_transfer_methods_item.py b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_document_transfer_methods_item.py new file mode 100644 index 0000000..8ee332d --- /dev/null +++ b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_document_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppAdvancedChatResponseFileUploadDocumentTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_image.py b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_image.py index 6d83699..a098378 100644 --- a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_image.py +++ b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_image.py @@ -28,7 +28,7 @@ class GetApplicationParametersByAppAdvancedChatResponseFileUploadImage(Universal typing.List[GetApplicationParametersByAppAdvancedChatResponseFileUploadImageTransferMethodsItem] ] = pydantic.Field(default=None) """ - Transfer method list, remote_url, local_file, one must be selected + Transfer method list: remote_url, local_file, one must be selected """ if IS_PYDANTIC_V2: diff --git a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_video.py b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_video.py new file mode 100644 index 0000000..194af96 --- /dev/null +++ b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_video.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_advanced_chat_response_file_upload_video_transfer_methods_item import ( + GetApplicationParametersByAppAdvancedChatResponseFileUploadVideoTransferMethodsItem, +) + + +class GetApplicationParametersByAppAdvancedChatResponseFileUploadVideo(UniversalBaseModel): + """ + Video settings. Currently only supports video types: mp4, mov, mpeg, mpga + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Video quantity limit, default 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppAdvancedChatResponseFileUploadVideoTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list: remote_url, local_file, one must be selected + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_video_transfer_methods_item.py b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_video_transfer_methods_item.py new file mode 100644 index 0000000..82d5c7a --- /dev/null +++ b/src/dify_sdk/advanced_chat/types/get_application_parameters_by_app_advanced_chat_response_file_upload_video_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppAdvancedChatResponseFileUploadVideoTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/chat/__init__.py b/src/dify_sdk/chat/__init__.py index e786946..421b6a4 100644 --- a/src/dify_sdk/chat/__init__.py +++ b/src/dify_sdk/chat/__init__.py @@ -36,6 +36,17 @@ GetApplicationInfoByAppChatResponse, GetApplicationParametersByAppChatResponse, GetApplicationParametersByAppChatResponseAnnotationReply, + GetApplicationParametersByAppChatResponseFileUpload, + GetApplicationParametersByAppChatResponseFileUploadAudio, + GetApplicationParametersByAppChatResponseFileUploadAudioTransferMethodsItem, + GetApplicationParametersByAppChatResponseFileUploadCustom, + GetApplicationParametersByAppChatResponseFileUploadCustomTransferMethodsItem, + GetApplicationParametersByAppChatResponseFileUploadDocument, + GetApplicationParametersByAppChatResponseFileUploadDocumentTransferMethodsItem, + GetApplicationParametersByAppChatResponseFileUploadImage, + GetApplicationParametersByAppChatResponseFileUploadImageTransferMethodsItem, + GetApplicationParametersByAppChatResponseFileUploadVideo, + GetApplicationParametersByAppChatResponseFileUploadVideoTransferMethodsItem, GetApplicationParametersByAppChatResponseRetrieverResource, GetApplicationParametersByAppChatResponseSpeechToText, GetApplicationParametersByAppChatResponseSuggestedQuestionsAfterAnswer, @@ -104,6 +115,17 @@ "GetApplicationInfoByAppChatResponse", "GetApplicationParametersByAppChatResponse", "GetApplicationParametersByAppChatResponseAnnotationReply", + "GetApplicationParametersByAppChatResponseFileUpload", + "GetApplicationParametersByAppChatResponseFileUploadAudio", + "GetApplicationParametersByAppChatResponseFileUploadAudioTransferMethodsItem", + "GetApplicationParametersByAppChatResponseFileUploadCustom", + "GetApplicationParametersByAppChatResponseFileUploadCustomTransferMethodsItem", + "GetApplicationParametersByAppChatResponseFileUploadDocument", + "GetApplicationParametersByAppChatResponseFileUploadDocumentTransferMethodsItem", + "GetApplicationParametersByAppChatResponseFileUploadImage", + "GetApplicationParametersByAppChatResponseFileUploadImageTransferMethodsItem", + "GetApplicationParametersByAppChatResponseFileUploadVideo", + "GetApplicationParametersByAppChatResponseFileUploadVideoTransferMethodsItem", "GetApplicationParametersByAppChatResponseRetrieverResource", "GetApplicationParametersByAppChatResponseSpeechToText", "GetApplicationParametersByAppChatResponseSuggestedQuestionsAfterAnswer", diff --git a/src/dify_sdk/chat/client.py b/src/dify_sdk/chat/client.py index 2e16949..9d40c81 100644 --- a/src/dify_sdk/chat/client.py +++ b/src/dify_sdk/chat/client.py @@ -62,6 +62,7 @@ def send_chat_message_by_app_chat( conversation_id: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[SendChatMessageByAppChatRequestFilesItem]] = OMIT, auto_generate_name: typing.Optional[bool] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[ChunkChatCompletionResponse]: """ @@ -93,6 +94,12 @@ def send_chat_message_by_app_chat( auto_generate_name : typing.Optional[bool] (Optional) Whether to automatically generate title, default is true. If set to false, you can call the conversation rename interface and set auto_generate to true to generate a title asynchronously. + trace_id : typing.Optional[str] + (Optional) Trace ID for linking with existing trace components in business systems, enabling end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods, in order of priority: + - Header: Passed through HTTP Header X-Trace-Id, highest priority. + - Query parameter: Passed through URL query parameter trace_id. + - Request Body: Passed through request body field trace_id (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -117,6 +124,7 @@ def send_chat_message_by_app_chat( conversation_id=conversation_id, files=files, auto_generate_name=auto_generate_name, + trace_id=trace_id, request_options=request_options, ) as r: yield from r.data @@ -923,6 +931,7 @@ async def send_chat_message_by_app_chat( conversation_id: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[SendChatMessageByAppChatRequestFilesItem]] = OMIT, auto_generate_name: typing.Optional[bool] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[ChunkChatCompletionResponse]: """ @@ -954,6 +963,12 @@ async def send_chat_message_by_app_chat( auto_generate_name : typing.Optional[bool] (Optional) Whether to automatically generate title, default is true. If set to false, you can call the conversation rename interface and set auto_generate to true to generate a title asynchronously. + trace_id : typing.Optional[str] + (Optional) Trace ID for linking with existing trace components in business systems, enabling end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods, in order of priority: + - Header: Passed through HTTP Header X-Trace-Id, highest priority. + - Query parameter: Passed through URL query parameter trace_id. + - Request Body: Passed through request body field trace_id (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -981,6 +996,7 @@ async def main() -> None: conversation_id=conversation_id, files=files, auto_generate_name=auto_generate_name, + trace_id=trace_id, request_options=request_options, ) as r: async for data in r.data: diff --git a/src/dify_sdk/chat/raw_client.py b/src/dify_sdk/chat/raw_client.py index 9cb5b4e..3d82e46 100644 --- a/src/dify_sdk/chat/raw_client.py +++ b/src/dify_sdk/chat/raw_client.py @@ -66,6 +66,7 @@ def send_chat_message_by_app_chat( conversation_id: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[SendChatMessageByAppChatRequestFilesItem]] = OMIT, auto_generate_name: typing.Optional[bool] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[HttpResponse[typing.Iterator[ChunkChatCompletionResponse]]]: """ @@ -97,6 +98,12 @@ def send_chat_message_by_app_chat( auto_generate_name : typing.Optional[bool] (Optional) Whether to automatically generate title, default is true. If set to false, you can call the conversation rename interface and set auto_generate to true to generate a title asynchronously. + trace_id : typing.Optional[str] + (Optional) Trace ID for linking with existing trace components in business systems, enabling end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods, in order of priority: + - Header: Passed through HTTP Header X-Trace-Id, highest priority. + - Query parameter: Passed through URL query parameter trace_id. + - Request Body: Passed through request body field trace_id (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -120,6 +127,7 @@ def send_chat_message_by_app_chat( direction="write", ), "auto_generate_name": auto_generate_name, + "trace_id": trace_id, }, headers={ "content-type": "application/json", @@ -1351,6 +1359,7 @@ async def send_chat_message_by_app_chat( conversation_id: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[SendChatMessageByAppChatRequestFilesItem]] = OMIT, auto_generate_name: typing.Optional[bool] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[ChunkChatCompletionResponse]]]: """ @@ -1382,6 +1391,12 @@ async def send_chat_message_by_app_chat( auto_generate_name : typing.Optional[bool] (Optional) Whether to automatically generate title, default is true. If set to false, you can call the conversation rename interface and set auto_generate to true to generate a title asynchronously. + trace_id : typing.Optional[str] + (Optional) Trace ID for linking with existing trace components in business systems, enabling end-to-end distributed tracing scenarios. If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods, in order of priority: + - Header: Passed through HTTP Header X-Trace-Id, highest priority. + - Query parameter: Passed through URL query parameter trace_id. + - Request Body: Passed through request body field trace_id (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1405,6 +1420,7 @@ async def send_chat_message_by_app_chat( direction="write", ), "auto_generate_name": auto_generate_name, + "trace_id": trace_id, }, headers={ "content-type": "application/json", diff --git a/src/dify_sdk/chat/types/__init__.py b/src/dify_sdk/chat/types/__init__.py index 0d4401e..b4683ee 100644 --- a/src/dify_sdk/chat/types/__init__.py +++ b/src/dify_sdk/chat/types/__init__.py @@ -39,6 +39,39 @@ from .get_application_parameters_by_app_chat_response_annotation_reply import ( GetApplicationParametersByAppChatResponseAnnotationReply, ) +from .get_application_parameters_by_app_chat_response_file_upload import ( + GetApplicationParametersByAppChatResponseFileUpload, +) +from .get_application_parameters_by_app_chat_response_file_upload_audio import ( + GetApplicationParametersByAppChatResponseFileUploadAudio, +) +from .get_application_parameters_by_app_chat_response_file_upload_audio_transfer_methods_item import ( + GetApplicationParametersByAppChatResponseFileUploadAudioTransferMethodsItem, +) +from .get_application_parameters_by_app_chat_response_file_upload_custom import ( + GetApplicationParametersByAppChatResponseFileUploadCustom, +) +from .get_application_parameters_by_app_chat_response_file_upload_custom_transfer_methods_item import ( + GetApplicationParametersByAppChatResponseFileUploadCustomTransferMethodsItem, +) +from .get_application_parameters_by_app_chat_response_file_upload_document import ( + GetApplicationParametersByAppChatResponseFileUploadDocument, +) +from .get_application_parameters_by_app_chat_response_file_upload_document_transfer_methods_item import ( + GetApplicationParametersByAppChatResponseFileUploadDocumentTransferMethodsItem, +) +from .get_application_parameters_by_app_chat_response_file_upload_image import ( + GetApplicationParametersByAppChatResponseFileUploadImage, +) +from .get_application_parameters_by_app_chat_response_file_upload_image_transfer_methods_item import ( + GetApplicationParametersByAppChatResponseFileUploadImageTransferMethodsItem, +) +from .get_application_parameters_by_app_chat_response_file_upload_video import ( + GetApplicationParametersByAppChatResponseFileUploadVideo, +) +from .get_application_parameters_by_app_chat_response_file_upload_video_transfer_methods_item import ( + GetApplicationParametersByAppChatResponseFileUploadVideoTransferMethodsItem, +) from .get_application_parameters_by_app_chat_response_retriever_resource import ( GetApplicationParametersByAppChatResponseRetrieverResource, ) @@ -110,6 +143,17 @@ "GetApplicationInfoByAppChatResponse", "GetApplicationParametersByAppChatResponse", "GetApplicationParametersByAppChatResponseAnnotationReply", + "GetApplicationParametersByAppChatResponseFileUpload", + "GetApplicationParametersByAppChatResponseFileUploadAudio", + "GetApplicationParametersByAppChatResponseFileUploadAudioTransferMethodsItem", + "GetApplicationParametersByAppChatResponseFileUploadCustom", + "GetApplicationParametersByAppChatResponseFileUploadCustomTransferMethodsItem", + "GetApplicationParametersByAppChatResponseFileUploadDocument", + "GetApplicationParametersByAppChatResponseFileUploadDocumentTransferMethodsItem", + "GetApplicationParametersByAppChatResponseFileUploadImage", + "GetApplicationParametersByAppChatResponseFileUploadImageTransferMethodsItem", + "GetApplicationParametersByAppChatResponseFileUploadVideo", + "GetApplicationParametersByAppChatResponseFileUploadVideoTransferMethodsItem", "GetApplicationParametersByAppChatResponseRetrieverResource", "GetApplicationParametersByAppChatResponseSpeechToText", "GetApplicationParametersByAppChatResponseSuggestedQuestionsAfterAnswer", diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response.py index 5b73066..877b96f 100644 --- a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response.py +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response.py @@ -7,6 +7,9 @@ from .get_application_parameters_by_app_chat_response_annotation_reply import ( GetApplicationParametersByAppChatResponseAnnotationReply, ) +from .get_application_parameters_by_app_chat_response_file_upload import ( + GetApplicationParametersByAppChatResponseFileUpload, +) from .get_application_parameters_by_app_chat_response_retriever_resource import ( GetApplicationParametersByAppChatResponseRetrieverResource, ) @@ -77,7 +80,7 @@ class GetApplicationParametersByAppChatResponse(UniversalBaseModel): User input form configuration """ - file_upload: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + file_upload: typing.Optional[GetApplicationParametersByAppChatResponseFileUpload] = pydantic.Field(default=None) """ File upload configuration """ diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload.py new file mode 100644 index 0000000..1c3b583 --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_chat_response_file_upload_audio import ( + GetApplicationParametersByAppChatResponseFileUploadAudio, +) +from .get_application_parameters_by_app_chat_response_file_upload_custom import ( + GetApplicationParametersByAppChatResponseFileUploadCustom, +) +from .get_application_parameters_by_app_chat_response_file_upload_document import ( + GetApplicationParametersByAppChatResponseFileUploadDocument, +) +from .get_application_parameters_by_app_chat_response_file_upload_image import ( + GetApplicationParametersByAppChatResponseFileUploadImage, +) +from .get_application_parameters_by_app_chat_response_file_upload_video import ( + GetApplicationParametersByAppChatResponseFileUploadVideo, +) + + +class GetApplicationParametersByAppChatResponseFileUpload(UniversalBaseModel): + """ + File upload configuration + """ + + document: typing.Optional[GetApplicationParametersByAppChatResponseFileUploadDocument] = pydantic.Field( + default=None + ) + """ + Document settings. Currently supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub. + """ + + image: typing.Optional[GetApplicationParametersByAppChatResponseFileUploadImage] = pydantic.Field(default=None) + """ + Image settings. Currently supports image types: png, jpg, jpeg, webp, gif. + """ + + audio: typing.Optional[GetApplicationParametersByAppChatResponseFileUploadAudio] = pydantic.Field(default=None) + """ + Audio settings. Currently supports audio types: mp3, m4a, wav, webm, amr. + """ + + video: typing.Optional[GetApplicationParametersByAppChatResponseFileUploadVideo] = pydantic.Field(default=None) + """ + Video settings. Currently supports video types: mp4, mov, mpeg, mpga. + """ + + custom: typing.Optional[GetApplicationParametersByAppChatResponseFileUploadCustom] = pydantic.Field(default=None) + """ + Custom settings + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_audio.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_audio.py new file mode 100644 index 0000000..8f5d031 --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_audio.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_chat_response_file_upload_audio_transfer_methods_item import ( + GetApplicationParametersByAppChatResponseFileUploadAudioTransferMethodsItem, +) + + +class GetApplicationParametersByAppChatResponseFileUploadAudio(UniversalBaseModel): + """ + Audio settings. Currently supports audio types: mp3, m4a, wav, webm, amr. + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Audio quantity limit, default is 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppChatResponseFileUploadAudioTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list: remote_url, local_file, must choose one. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_audio_transfer_methods_item.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_audio_transfer_methods_item.py new file mode 100644 index 0000000..55ce32f --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_audio_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppChatResponseFileUploadAudioTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_custom.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_custom.py new file mode 100644 index 0000000..efd24f7 --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_custom.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_chat_response_file_upload_custom_transfer_methods_item import ( + GetApplicationParametersByAppChatResponseFileUploadCustomTransferMethodsItem, +) + + +class GetApplicationParametersByAppChatResponseFileUploadCustom(UniversalBaseModel): + """ + Custom settings + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Custom quantity limit, default is 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppChatResponseFileUploadCustomTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list: remote_url, local_file, must choose one. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_custom_transfer_methods_item.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_custom_transfer_methods_item.py new file mode 100644 index 0000000..c586528 --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_custom_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppChatResponseFileUploadCustomTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_document.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_document.py new file mode 100644 index 0000000..3fe1cf6 --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_document.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_chat_response_file_upload_document_transfer_methods_item import ( + GetApplicationParametersByAppChatResponseFileUploadDocumentTransferMethodsItem, +) + + +class GetApplicationParametersByAppChatResponseFileUploadDocument(UniversalBaseModel): + """ + Document settings. Currently supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub. + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Document quantity limit, default is 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppChatResponseFileUploadDocumentTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list: remote_url, local_file, must choose one. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_document_transfer_methods_item.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_document_transfer_methods_item.py new file mode 100644 index 0000000..fa74016 --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_document_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppChatResponseFileUploadDocumentTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_image.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_image.py new file mode 100644 index 0000000..92707bf --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_image.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_chat_response_file_upload_image_transfer_methods_item import ( + GetApplicationParametersByAppChatResponseFileUploadImageTransferMethodsItem, +) + + +class GetApplicationParametersByAppChatResponseFileUploadImage(UniversalBaseModel): + """ + Image settings. Currently supports image types: png, jpg, jpeg, webp, gif. + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Image quantity limit, default is 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppChatResponseFileUploadImageTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list: remote_url, local_file, must choose one. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_image_transfer_methods_item.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_image_transfer_methods_item.py new file mode 100644 index 0000000..871a0e7 --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_image_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppChatResponseFileUploadImageTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_video.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_video.py new file mode 100644 index 0000000..3ee6d6a --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_video.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_chat_response_file_upload_video_transfer_methods_item import ( + GetApplicationParametersByAppChatResponseFileUploadVideoTransferMethodsItem, +) + + +class GetApplicationParametersByAppChatResponseFileUploadVideo(UniversalBaseModel): + """ + Video settings. Currently supports video types: mp4, mov, mpeg, mpga. + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Video quantity limit, default is 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppChatResponseFileUploadVideoTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list: remote_url, local_file, must choose one. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_video_transfer_methods_item.py b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_video_transfer_methods_item.py new file mode 100644 index 0000000..ab7e659 --- /dev/null +++ b/src/dify_sdk/chat/types/get_application_parameters_by_app_chat_response_file_upload_video_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppChatResponseFileUploadVideoTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/generation/__init__.py b/src/dify_sdk/generation/__init__.py index 6be7d0f..9b8e1c6 100644 --- a/src/dify_sdk/generation/__init__.py +++ b/src/dify_sdk/generation/__init__.py @@ -14,6 +14,7 @@ Error, FileInput, FileInputTransferMethod, + FileInputType, GetAnnotationReplyStatusByAppGenerationRequestAction, GetAnnotationReplyStatusByAppGenerationResponse, GetAnnotationsListByAppGenerationResponse, @@ -28,8 +29,16 @@ GetApplicationParametersByAppGenerationResponse, GetApplicationParametersByAppGenerationResponseAnnotationReply, GetApplicationParametersByAppGenerationResponseFileUpload, + GetApplicationParametersByAppGenerationResponseFileUploadAudio, + GetApplicationParametersByAppGenerationResponseFileUploadAudioTransferMethodsItem, + GetApplicationParametersByAppGenerationResponseFileUploadCustom, + GetApplicationParametersByAppGenerationResponseFileUploadCustomTransferMethodsItem, + GetApplicationParametersByAppGenerationResponseFileUploadDocument, + GetApplicationParametersByAppGenerationResponseFileUploadDocumentTransferMethodsItem, GetApplicationParametersByAppGenerationResponseFileUploadImage, GetApplicationParametersByAppGenerationResponseFileUploadImageTransferMethodsItem, + GetApplicationParametersByAppGenerationResponseFileUploadVideo, + GetApplicationParametersByAppGenerationResponseFileUploadVideoTransferMethodsItem, GetApplicationParametersByAppGenerationResponseRetrieverResource, GetApplicationParametersByAppGenerationResponseSpeechToText, GetApplicationParametersByAppGenerationResponseSuggestedQuestionsAfterAnswer, @@ -74,6 +83,7 @@ "Error", "FileInput", "FileInputTransferMethod", + "FileInputType", "GetAnnotationReplyStatusByAppGenerationRequestAction", "GetAnnotationReplyStatusByAppGenerationResponse", "GetAnnotationsListByAppGenerationResponse", @@ -88,8 +98,16 @@ "GetApplicationParametersByAppGenerationResponse", "GetApplicationParametersByAppGenerationResponseAnnotationReply", "GetApplicationParametersByAppGenerationResponseFileUpload", + "GetApplicationParametersByAppGenerationResponseFileUploadAudio", + "GetApplicationParametersByAppGenerationResponseFileUploadAudioTransferMethodsItem", + "GetApplicationParametersByAppGenerationResponseFileUploadCustom", + "GetApplicationParametersByAppGenerationResponseFileUploadCustomTransferMethodsItem", + "GetApplicationParametersByAppGenerationResponseFileUploadDocument", + "GetApplicationParametersByAppGenerationResponseFileUploadDocumentTransferMethodsItem", "GetApplicationParametersByAppGenerationResponseFileUploadImage", "GetApplicationParametersByAppGenerationResponseFileUploadImageTransferMethodsItem", + "GetApplicationParametersByAppGenerationResponseFileUploadVideo", + "GetApplicationParametersByAppGenerationResponseFileUploadVideoTransferMethodsItem", "GetApplicationParametersByAppGenerationResponseRetrieverResource", "GetApplicationParametersByAppGenerationResponseSpeechToText", "GetApplicationParametersByAppGenerationResponseSuggestedQuestionsAfterAnswer", diff --git a/src/dify_sdk/generation/client.py b/src/dify_sdk/generation/client.py index 325998f..2c3efc0 100644 --- a/src/dify_sdk/generation/client.py +++ b/src/dify_sdk/generation/client.py @@ -65,6 +65,7 @@ def send_completion_message_by_app_generation( response_mode: typing.Optional[SendCompletionMessageByAppGenerationRequestResponseMode] = OMIT, user: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[FileInput]] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[ChunkChatCompletionResponse]: """ @@ -84,6 +85,13 @@ def send_completion_message_by_app_generation( files : typing.Optional[typing.Sequence[FileInput]] + trace_id : typing.Optional[str] + (Optional) Trace ID for linking with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. + If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods with priority order: + - Header: Pass through HTTP Header X-Trace-Id, highest priority + - Query parameter: Pass through URL query parameter trace_id + - Request Body: Pass through request body field trace_id (this field) + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -102,7 +110,12 @@ def send_completion_message_by_app_generation( yield chunk """ with self._raw_client.send_completion_message_by_app_generation( - inputs=inputs, response_mode=response_mode, user=user, files=files, request_options=request_options + inputs=inputs, + response_mode=response_mode, + user=user, + files=files, + trace_id=trace_id, + request_options=request_options, ) as r: yield from r.data @@ -635,6 +648,7 @@ async def send_completion_message_by_app_generation( response_mode: typing.Optional[SendCompletionMessageByAppGenerationRequestResponseMode] = OMIT, user: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[FileInput]] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[ChunkChatCompletionResponse]: """ @@ -654,6 +668,13 @@ async def send_completion_message_by_app_generation( files : typing.Optional[typing.Sequence[FileInput]] + trace_id : typing.Optional[str] + (Optional) Trace ID for linking with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. + If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods with priority order: + - Header: Pass through HTTP Header X-Trace-Id, highest priority + - Query parameter: Pass through URL query parameter trace_id + - Request Body: Pass through request body field trace_id (this field) + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -675,7 +696,12 @@ async def main() -> None: asyncio.run(main()) """ async with self._raw_client.send_completion_message_by_app_generation( - inputs=inputs, response_mode=response_mode, user=user, files=files, request_options=request_options + inputs=inputs, + response_mode=response_mode, + user=user, + files=files, + trace_id=trace_id, + request_options=request_options, ) as r: async for data in r.data: yield data diff --git a/src/dify_sdk/generation/raw_client.py b/src/dify_sdk/generation/raw_client.py index d75abce..14c4263 100644 --- a/src/dify_sdk/generation/raw_client.py +++ b/src/dify_sdk/generation/raw_client.py @@ -69,6 +69,7 @@ def send_completion_message_by_app_generation( response_mode: typing.Optional[SendCompletionMessageByAppGenerationRequestResponseMode] = OMIT, user: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[FileInput]] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[HttpResponse[typing.Iterator[ChunkChatCompletionResponse]]]: """ @@ -88,6 +89,13 @@ def send_completion_message_by_app_generation( files : typing.Optional[typing.Sequence[FileInput]] + trace_id : typing.Optional[str] + (Optional) Trace ID for linking with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. + If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods with priority order: + - Header: Pass through HTTP Header X-Trace-Id, highest priority + - Query parameter: Pass through URL query parameter trace_id + - Request Body: Pass through request body field trace_id (this field) + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -108,6 +116,7 @@ def send_completion_message_by_app_generation( "files": convert_and_respect_annotation_metadata( object_=files, annotation=typing.Sequence[FileInput], direction="write" ), + "trace_id": trace_id, }, headers={ "content-type": "application/json", @@ -944,6 +953,7 @@ async def send_completion_message_by_app_generation( response_mode: typing.Optional[SendCompletionMessageByAppGenerationRequestResponseMode] = OMIT, user: typing.Optional[str] = OMIT, files: typing.Optional[typing.Sequence[FileInput]] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[ChunkChatCompletionResponse]]]: """ @@ -963,6 +973,13 @@ async def send_completion_message_by_app_generation( files : typing.Optional[typing.Sequence[FileInput]] + trace_id : typing.Optional[str] + (Optional) Trace ID for linking with existing trace components in business systems to achieve end-to-end distributed tracing scenarios. + If not specified, the system will automatically generate a trace_id. Supports the following three transmission methods with priority order: + - Header: Pass through HTTP Header X-Trace-Id, highest priority + - Query parameter: Pass through URL query parameter trace_id + - Request Body: Pass through request body field trace_id (this field) + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -983,6 +1000,7 @@ async def send_completion_message_by_app_generation( "files": convert_and_respect_annotation_metadata( object_=files, annotation=typing.Sequence[FileInput], direction="write" ), + "trace_id": trace_id, }, headers={ "content-type": "application/json", diff --git a/src/dify_sdk/generation/types/__init__.py b/src/dify_sdk/generation/types/__init__.py index 5b6a1c0..8099eb8 100644 --- a/src/dify_sdk/generation/types/__init__.py +++ b/src/dify_sdk/generation/types/__init__.py @@ -15,6 +15,7 @@ from .error import Error from .file_input import FileInput from .file_input_transfer_method import FileInputTransferMethod +from .file_input_type import FileInputType from .get_annotation_reply_status_by_app_generation_request_action import ( GetAnnotationReplyStatusByAppGenerationRequestAction, ) @@ -39,12 +40,36 @@ from .get_application_parameters_by_app_generation_response_file_upload import ( GetApplicationParametersByAppGenerationResponseFileUpload, ) +from .get_application_parameters_by_app_generation_response_file_upload_audio import ( + GetApplicationParametersByAppGenerationResponseFileUploadAudio, +) +from .get_application_parameters_by_app_generation_response_file_upload_audio_transfer_methods_item import ( + GetApplicationParametersByAppGenerationResponseFileUploadAudioTransferMethodsItem, +) +from .get_application_parameters_by_app_generation_response_file_upload_custom import ( + GetApplicationParametersByAppGenerationResponseFileUploadCustom, +) +from .get_application_parameters_by_app_generation_response_file_upload_custom_transfer_methods_item import ( + GetApplicationParametersByAppGenerationResponseFileUploadCustomTransferMethodsItem, +) +from .get_application_parameters_by_app_generation_response_file_upload_document import ( + GetApplicationParametersByAppGenerationResponseFileUploadDocument, +) +from .get_application_parameters_by_app_generation_response_file_upload_document_transfer_methods_item import ( + GetApplicationParametersByAppGenerationResponseFileUploadDocumentTransferMethodsItem, +) from .get_application_parameters_by_app_generation_response_file_upload_image import ( GetApplicationParametersByAppGenerationResponseFileUploadImage, ) from .get_application_parameters_by_app_generation_response_file_upload_image_transfer_methods_item import ( GetApplicationParametersByAppGenerationResponseFileUploadImageTransferMethodsItem, ) +from .get_application_parameters_by_app_generation_response_file_upload_video import ( + GetApplicationParametersByAppGenerationResponseFileUploadVideo, +) +from .get_application_parameters_by_app_generation_response_file_upload_video_transfer_methods_item import ( + GetApplicationParametersByAppGenerationResponseFileUploadVideoTransferMethodsItem, +) from .get_application_parameters_by_app_generation_response_retriever_resource import ( GetApplicationParametersByAppGenerationResponseRetrieverResource, ) @@ -102,6 +127,7 @@ "Error", "FileInput", "FileInputTransferMethod", + "FileInputType", "GetAnnotationReplyStatusByAppGenerationRequestAction", "GetAnnotationReplyStatusByAppGenerationResponse", "GetAnnotationsListByAppGenerationResponse", @@ -116,8 +142,16 @@ "GetApplicationParametersByAppGenerationResponse", "GetApplicationParametersByAppGenerationResponseAnnotationReply", "GetApplicationParametersByAppGenerationResponseFileUpload", + "GetApplicationParametersByAppGenerationResponseFileUploadAudio", + "GetApplicationParametersByAppGenerationResponseFileUploadAudioTransferMethodsItem", + "GetApplicationParametersByAppGenerationResponseFileUploadCustom", + "GetApplicationParametersByAppGenerationResponseFileUploadCustomTransferMethodsItem", + "GetApplicationParametersByAppGenerationResponseFileUploadDocument", + "GetApplicationParametersByAppGenerationResponseFileUploadDocumentTransferMethodsItem", "GetApplicationParametersByAppGenerationResponseFileUploadImage", "GetApplicationParametersByAppGenerationResponseFileUploadImageTransferMethodsItem", + "GetApplicationParametersByAppGenerationResponseFileUploadVideo", + "GetApplicationParametersByAppGenerationResponseFileUploadVideoTransferMethodsItem", "GetApplicationParametersByAppGenerationResponseRetrieverResource", "GetApplicationParametersByAppGenerationResponseSpeechToText", "GetApplicationParametersByAppGenerationResponseSuggestedQuestionsAfterAnswer", diff --git a/src/dify_sdk/generation/types/file_input.py b/src/dify_sdk/generation/types/file_input.py index 42a008f..abe6670 100644 --- a/src/dify_sdk/generation/types/file_input.py +++ b/src/dify_sdk/generation/types/file_input.py @@ -5,12 +5,18 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .file_input_transfer_method import FileInputTransferMethod +from .file_input_type import FileInputType class FileInput(UniversalBaseModel): - type: typing.Optional[typing.Literal["image"]] = pydantic.Field(default=None) + type: typing.Optional[FileInputType] = pydantic.Field(default=None) """ - File type, currently only supports images + File type: + - document: Document types (txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub) + - image: Image types (png, jpg, jpeg, webp, gif) + - audio: Audio types (mp3, m4a, wav, webm, amr) + - video: Video types (mp4, mov, mpeg, mpga) + - custom: Custom types """ transfer_method: typing.Optional[FileInputTransferMethod] = pydantic.Field(default=None) @@ -20,7 +26,7 @@ class FileInput(UniversalBaseModel): url: typing.Optional[str] = pydantic.Field(default=None) """ - Image URL (only when transfer method is remote_url) + File URL (only when transfer method is remote_url) """ upload_file_id: typing.Optional[str] = pydantic.Field(default=None) diff --git a/src/dify_sdk/generation/types/file_input_type.py b/src/dify_sdk/generation/types/file_input_type.py new file mode 100644 index 0000000..0040e57 --- /dev/null +++ b/src/dify_sdk/generation/types/file_input_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FileInputType = typing.Union[typing.Literal["document", "image", "audio", "video", "custom"], typing.Any] diff --git a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload.py b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload.py index ae55412..4375477 100644 --- a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload.py +++ b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload.py @@ -4,9 +4,21 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_generation_response_file_upload_audio import ( + GetApplicationParametersByAppGenerationResponseFileUploadAudio, +) +from .get_application_parameters_by_app_generation_response_file_upload_custom import ( + GetApplicationParametersByAppGenerationResponseFileUploadCustom, +) +from .get_application_parameters_by_app_generation_response_file_upload_document import ( + GetApplicationParametersByAppGenerationResponseFileUploadDocument, +) from .get_application_parameters_by_app_generation_response_file_upload_image import ( GetApplicationParametersByAppGenerationResponseFileUploadImage, ) +from .get_application_parameters_by_app_generation_response_file_upload_video import ( + GetApplicationParametersByAppGenerationResponseFileUploadVideo, +) class GetApplicationParametersByAppGenerationResponseFileUpload(UniversalBaseModel): @@ -14,11 +26,43 @@ class GetApplicationParametersByAppGenerationResponseFileUpload(UniversalBaseMod File upload configuration """ + document: typing.Optional[GetApplicationParametersByAppGenerationResponseFileUploadDocument] = pydantic.Field( + default=None + ) + """ + Document settings + Currently only supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub + """ + image: typing.Optional[GetApplicationParametersByAppGenerationResponseFileUploadImage] = pydantic.Field( default=None ) """ Image settings + Currently only supports image types: png, jpg, jpeg, webp, gif + """ + + audio: typing.Optional[GetApplicationParametersByAppGenerationResponseFileUploadAudio] = pydantic.Field( + default=None + ) + """ + Audio settings + Currently only supports audio types: mp3, m4a, wav, webm, amr + """ + + video: typing.Optional[GetApplicationParametersByAppGenerationResponseFileUploadVideo] = pydantic.Field( + default=None + ) + """ + Video settings + Currently only supports video types: mp4, mov, mpeg, mpga + """ + + custom: typing.Optional[GetApplicationParametersByAppGenerationResponseFileUploadCustom] = pydantic.Field( + default=None + ) + """ + Custom settings """ if IS_PYDANTIC_V2: diff --git a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_audio.py b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_audio.py new file mode 100644 index 0000000..61f0caf --- /dev/null +++ b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_audio.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_generation_response_file_upload_audio_transfer_methods_item import ( + GetApplicationParametersByAppGenerationResponseFileUploadAudioTransferMethodsItem, +) + + +class GetApplicationParametersByAppGenerationResponseFileUploadAudio(UniversalBaseModel): + """ + Audio settings + Currently only supports audio types: mp3, m4a, wav, webm, amr + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Audio quantity limit, default 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppGenerationResponseFileUploadAudioTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list, must choose one + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_audio_transfer_methods_item.py b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_audio_transfer_methods_item.py new file mode 100644 index 0000000..e423556 --- /dev/null +++ b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_audio_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppGenerationResponseFileUploadAudioTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_custom.py b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_custom.py new file mode 100644 index 0000000..20ab940 --- /dev/null +++ b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_custom.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_generation_response_file_upload_custom_transfer_methods_item import ( + GetApplicationParametersByAppGenerationResponseFileUploadCustomTransferMethodsItem, +) + + +class GetApplicationParametersByAppGenerationResponseFileUploadCustom(UniversalBaseModel): + """ + Custom settings + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Custom quantity limit, default 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppGenerationResponseFileUploadCustomTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list, must choose one + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_custom_transfer_methods_item.py b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_custom_transfer_methods_item.py new file mode 100644 index 0000000..5b00c45 --- /dev/null +++ b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_custom_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppGenerationResponseFileUploadCustomTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_document.py b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_document.py new file mode 100644 index 0000000..c09a7cb --- /dev/null +++ b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_document.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_generation_response_file_upload_document_transfer_methods_item import ( + GetApplicationParametersByAppGenerationResponseFileUploadDocumentTransferMethodsItem, +) + + +class GetApplicationParametersByAppGenerationResponseFileUploadDocument(UniversalBaseModel): + """ + Document settings + Currently only supports document types: txt, md, markdown, pdf, html, xlsx, xls, docx, csv, eml, msg, pptx, ppt, xml, epub + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Document quantity limit, default 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppGenerationResponseFileUploadDocumentTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list, must choose one + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_document_transfer_methods_item.py b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_document_transfer_methods_item.py new file mode 100644 index 0000000..6c0c313 --- /dev/null +++ b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_document_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppGenerationResponseFileUploadDocumentTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_image.py b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_image.py index 1edd0ca..527c86b 100644 --- a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_image.py +++ b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_image.py @@ -12,6 +12,7 @@ class GetApplicationParametersByAppGenerationResponseFileUploadImage(UniversalBaseModel): """ Image settings + Currently only supports image types: png, jpg, jpeg, webp, gif """ enabled: typing.Optional[bool] = pydantic.Field(default=None) @@ -28,7 +29,7 @@ class GetApplicationParametersByAppGenerationResponseFileUploadImage(UniversalBa typing.List[GetApplicationParametersByAppGenerationResponseFileUploadImageTransferMethodsItem] ] = pydantic.Field(default=None) """ - Transfer method list + Transfer method list, must choose one """ if IS_PYDANTIC_V2: diff --git a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_video.py b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_video.py new file mode 100644 index 0000000..1a10601 --- /dev/null +++ b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_video.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_application_parameters_by_app_generation_response_file_upload_video_transfer_methods_item import ( + GetApplicationParametersByAppGenerationResponseFileUploadVideoTransferMethodsItem, +) + + +class GetApplicationParametersByAppGenerationResponseFileUploadVideo(UniversalBaseModel): + """ + Video settings + Currently only supports video types: mp4, mov, mpeg, mpga + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Video quantity limit, default 3 + """ + + transfer_methods: typing.Optional[ + typing.List[GetApplicationParametersByAppGenerationResponseFileUploadVideoTransferMethodsItem] + ] = pydantic.Field(default=None) + """ + Transfer method list, must choose one + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_video_transfer_methods_item.py b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_video_transfer_methods_item.py new file mode 100644 index 0000000..24ffe4d --- /dev/null +++ b/src/dify_sdk/generation/types/get_application_parameters_by_app_generation_response_file_upload_video_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetApplicationParametersByAppGenerationResponseFileUploadVideoTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/knowledge_base/__init__.py b/src/dify_sdk/knowledge_base/__init__.py index 13cd81f..6fecd43 100644 --- a/src/dify_sdk/knowledge_base/__init__.py +++ b/src/dify_sdk/knowledge_base/__init__.py @@ -49,9 +49,12 @@ ProcessRule, ProcessRuleMode, ProcessRuleRules, + ProcessRuleRulesParentMode, ProcessRuleRulesPreProcessingRulesItem, ProcessRuleRulesSegmentation, + ProcessRuleRulesSubchunkSegmentation, RetrievalModel, + RetrievalModelRerankingMode, RetrievalModelRerankingModel, RetrievalModelSearchMethod, Segment, @@ -203,9 +206,12 @@ "ProcessRule", "ProcessRuleMode", "ProcessRuleRules", + "ProcessRuleRulesParentMode", "ProcessRuleRulesPreProcessingRulesItem", "ProcessRuleRulesSegmentation", + "ProcessRuleRulesSubchunkSegmentation", "RetrievalModel", + "RetrievalModelRerankingMode", "RetrievalModelRerankingModel", "RetrievalModelSearchMethod", "RetrieveDatasetResponse", diff --git a/src/dify_sdk/knowledge_base/datasets/client.py b/src/dify_sdk/knowledge_base/datasets/client.py index 488938d..9e9ee4f 100644 --- a/src/dify_sdk/knowledge_base/datasets/client.py +++ b/src/dify_sdk/knowledge_base/datasets/client.py @@ -217,7 +217,7 @@ def update_knowledge_base_details( permission: typing.Optional[PatchDatasetsDatasetIdRequestPermission] = OMIT, embedding_model_provider: typing.Optional[str] = OMIT, embedding_model: typing.Optional[str] = OMIT, - retrieval_model: typing.Optional[str] = OMIT, + retrieval_model: typing.Optional[RetrievalModel] = OMIT, partial_member_list: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Dataset: @@ -249,8 +249,7 @@ def update_knowledge_base_details( embedding_model : typing.Optional[str] Embedding model (optional) - retrieval_model : typing.Optional[str] - Retrieval model (optional) + retrieval_model : typing.Optional[RetrievalModel] partial_member_list : typing.Optional[typing.Sequence[str]] Partial team members ID list (optional) @@ -542,7 +541,7 @@ async def update_knowledge_base_details( permission: typing.Optional[PatchDatasetsDatasetIdRequestPermission] = OMIT, embedding_model_provider: typing.Optional[str] = OMIT, embedding_model: typing.Optional[str] = OMIT, - retrieval_model: typing.Optional[str] = OMIT, + retrieval_model: typing.Optional[RetrievalModel] = OMIT, partial_member_list: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> Dataset: @@ -574,8 +573,7 @@ async def update_knowledge_base_details( embedding_model : typing.Optional[str] Embedding model (optional) - retrieval_model : typing.Optional[str] - Retrieval model (optional) + retrieval_model : typing.Optional[RetrievalModel] partial_member_list : typing.Optional[typing.Sequence[str]] Partial team members ID list (optional) diff --git a/src/dify_sdk/knowledge_base/datasets/raw_client.py b/src/dify_sdk/knowledge_base/datasets/raw_client.py index b983f58..38479f8 100644 --- a/src/dify_sdk/knowledge_base/datasets/raw_client.py +++ b/src/dify_sdk/knowledge_base/datasets/raw_client.py @@ -334,7 +334,7 @@ def update_knowledge_base_details( permission: typing.Optional[PatchDatasetsDatasetIdRequestPermission] = OMIT, embedding_model_provider: typing.Optional[str] = OMIT, embedding_model: typing.Optional[str] = OMIT, - retrieval_model: typing.Optional[str] = OMIT, + retrieval_model: typing.Optional[RetrievalModel] = OMIT, partial_member_list: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[Dataset]: @@ -366,8 +366,7 @@ def update_knowledge_base_details( embedding_model : typing.Optional[str] Embedding model (optional) - retrieval_model : typing.Optional[str] - Retrieval model (optional) + retrieval_model : typing.Optional[RetrievalModel] partial_member_list : typing.Optional[typing.Sequence[str]] Partial team members ID list (optional) @@ -389,7 +388,9 @@ def update_knowledge_base_details( "permission": permission, "embedding_model_provider": embedding_model_provider, "embedding_model": embedding_model, - "retrieval_model": retrieval_model, + "retrieval_model": convert_and_respect_annotation_metadata( + object_=retrieval_model, annotation=RetrievalModel, direction="write" + ), "partial_member_list": partial_member_list, }, headers={ @@ -825,7 +826,7 @@ async def update_knowledge_base_details( permission: typing.Optional[PatchDatasetsDatasetIdRequestPermission] = OMIT, embedding_model_provider: typing.Optional[str] = OMIT, embedding_model: typing.Optional[str] = OMIT, - retrieval_model: typing.Optional[str] = OMIT, + retrieval_model: typing.Optional[RetrievalModel] = OMIT, partial_member_list: typing.Optional[typing.Sequence[str]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[Dataset]: @@ -857,8 +858,7 @@ async def update_knowledge_base_details( embedding_model : typing.Optional[str] Embedding model (optional) - retrieval_model : typing.Optional[str] - Retrieval model (optional) + retrieval_model : typing.Optional[RetrievalModel] partial_member_list : typing.Optional[typing.Sequence[str]] Partial team members ID list (optional) @@ -880,7 +880,9 @@ async def update_knowledge_base_details( "permission": permission, "embedding_model_provider": embedding_model_provider, "embedding_model": embedding_model, - "retrieval_model": retrieval_model, + "retrieval_model": convert_and_respect_annotation_metadata( + object_=retrieval_model, annotation=RetrievalModel, direction="write" + ), "partial_member_list": partial_member_list, }, headers={ diff --git a/src/dify_sdk/knowledge_base/types/__init__.py b/src/dify_sdk/knowledge_base/types/__init__.py index b98575d..fcf85f6 100644 --- a/src/dify_sdk/knowledge_base/types/__init__.py +++ b/src/dify_sdk/knowledge_base/types/__init__.py @@ -56,9 +56,12 @@ from .process_rule import ProcessRule from .process_rule_mode import ProcessRuleMode from .process_rule_rules import ProcessRuleRules +from .process_rule_rules_parent_mode import ProcessRuleRulesParentMode from .process_rule_rules_pre_processing_rules_item import ProcessRuleRulesPreProcessingRulesItem from .process_rule_rules_segmentation import ProcessRuleRulesSegmentation +from .process_rule_rules_subchunk_segmentation import ProcessRuleRulesSubchunkSegmentation from .retrieval_model import RetrievalModel +from .retrieval_model_reranking_mode import RetrievalModelRerankingMode from .retrieval_model_reranking_model import RetrievalModelRerankingModel from .retrieval_model_search_method import RetrievalModelSearchMethod from .segment import Segment @@ -115,9 +118,12 @@ "ProcessRule", "ProcessRuleMode", "ProcessRuleRules", + "ProcessRuleRulesParentMode", "ProcessRuleRulesPreProcessingRulesItem", "ProcessRuleRulesSegmentation", + "ProcessRuleRulesSubchunkSegmentation", "RetrievalModel", + "RetrievalModelRerankingMode", "RetrievalModelRerankingModel", "RetrievalModelSearchMethod", "Segment", diff --git a/src/dify_sdk/knowledge_base/types/create_document_by_file_request_data.py b/src/dify_sdk/knowledge_base/types/create_document_by_file_request_data.py index 225037a..e34a0eb 100644 --- a/src/dify_sdk/knowledge_base/types/create_document_by_file_request_data.py +++ b/src/dify_sdk/knowledge_base/types/create_document_by_file_request_data.py @@ -28,16 +28,21 @@ class CreateDocumentByFileRequestData(UniversalBaseModel): indexing_technique: typing.Optional[CreateDocumentByFileRequestDataIndexingTechnique] = pydantic.Field(default=None) """ Indexing technique + - high_quality: High quality: Use Embedding model for embedding, build as vector database index + - economy: Economy: Build using keyword table index inverted index """ doc_form: typing.Optional[CreateDocumentByFileRequestDataDocForm] = pydantic.Field(default=None) """ Document form + - text_model: Direct text document embedding, default mode for economy + - hierarchical_model: Parent-child mode + - qa_model: Q&A mode: Generate Q&A pairs for segmented documents, then embed questions """ doc_language: typing.Optional[str] = pydantic.Field(default=None) """ - Document language (required for Q&A mode) + In Q&A mode, specify the document language, e.g.: English, Chinese """ process_rule: typing.Optional[ProcessRule] = pydantic.Field(default=None) diff --git a/src/dify_sdk/knowledge_base/types/process_rule_mode.py b/src/dify_sdk/knowledge_base/types/process_rule_mode.py index 68ab8a1..ecc1e2c 100644 --- a/src/dify_sdk/knowledge_base/types/process_rule_mode.py +++ b/src/dify_sdk/knowledge_base/types/process_rule_mode.py @@ -2,4 +2,4 @@ import typing -ProcessRuleMode = typing.Union[typing.Literal["automatic", "custom"], typing.Any] +ProcessRuleMode = typing.Union[typing.Literal["automatic", "custom", "hierarchical"], typing.Any] diff --git a/src/dify_sdk/knowledge_base/types/process_rule_rules.py b/src/dify_sdk/knowledge_base/types/process_rule_rules.py index a359491..3422344 100644 --- a/src/dify_sdk/knowledge_base/types/process_rule_rules.py +++ b/src/dify_sdk/knowledge_base/types/process_rule_rules.py @@ -4,8 +4,10 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .process_rule_rules_parent_mode import ProcessRuleRulesParentMode from .process_rule_rules_pre_processing_rules_item import ProcessRuleRulesPreProcessingRulesItem from .process_rule_rules_segmentation import ProcessRuleRulesSegmentation +from .process_rule_rules_subchunk_segmentation import ProcessRuleRulesSubchunkSegmentation class ProcessRuleRules(UniversalBaseModel): @@ -25,6 +27,18 @@ class ProcessRuleRules(UniversalBaseModel): Segmentation configuration """ + parent_mode: typing.Optional[ProcessRuleRulesParentMode] = pydantic.Field(default=None) + """ + Parent segment recall mode + - full-doc: Full document recall + - paragraph: Paragraph recall + """ + + subchunk_segmentation: typing.Optional[ProcessRuleRulesSubchunkSegmentation] = pydantic.Field(default=None) + """ + Sub-chunk segmentation rules + """ + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: diff --git a/src/dify_sdk/knowledge_base/types/process_rule_rules_parent_mode.py b/src/dify_sdk/knowledge_base/types/process_rule_rules_parent_mode.py new file mode 100644 index 0000000..d5b9674 --- /dev/null +++ b/src/dify_sdk/knowledge_base/types/process_rule_rules_parent_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProcessRuleRulesParentMode = typing.Union[typing.Literal["full-doc", "paragraph"], typing.Any] diff --git a/src/dify_sdk/knowledge_base/types/process_rule_rules_subchunk_segmentation.py b/src/dify_sdk/knowledge_base/types/process_rule_rules_subchunk_segmentation.py new file mode 100644 index 0000000..0fda43b --- /dev/null +++ b/src/dify_sdk/knowledge_base/types/process_rule_rules_subchunk_segmentation.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class ProcessRuleRulesSubchunkSegmentation(UniversalBaseModel): + """ + Sub-chunk segmentation rules + """ + + separator: typing.Optional[str] = pydantic.Field(default=None) + """ + Segmentation identifier, only one separator is allowed. Default is *** + """ + + max_tokens: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum length (tokens), must be less than parent level + """ + + chunk_overlap: typing.Optional[int] = pydantic.Field(default=None) + """ + Segment overlap refers to a certain overlap between segments when segmenting data (optional) + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/knowledge_base/types/retrieval_model.py b/src/dify_sdk/knowledge_base/types/retrieval_model.py index 0437a1b..16209ba 100644 --- a/src/dify_sdk/knowledge_base/types/retrieval_model.py +++ b/src/dify_sdk/knowledge_base/types/retrieval_model.py @@ -5,6 +5,7 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from .metadata_filtering_conditions import MetadataFilteringConditions +from .retrieval_model_reranking_mode import RetrievalModelRerankingMode from .retrieval_model_reranking_model import RetrievalModelRerankingModel from .retrieval_model_search_method import RetrievalModelSearchMethod @@ -24,6 +25,13 @@ class RetrievalModel(UniversalBaseModel): Whether reranking is enabled (optional). Required if search mode is semantic_search or hybrid_search """ + reranking_mode: typing.Optional[RetrievalModelRerankingMode] = pydantic.Field(default=None) + """ + Rerank mode + - weighted_score: Weight setting + - reranking_model: Rerank model + """ + reranking_model: typing.Optional[RetrievalModelRerankingModel] = pydantic.Field(default=None) """ Rerank model configuration (optional). Required if reranking is enabled diff --git a/src/dify_sdk/knowledge_base/types/retrieval_model_reranking_mode.py b/src/dify_sdk/knowledge_base/types/retrieval_model_reranking_mode.py new file mode 100644 index 0000000..0deff3b --- /dev/null +++ b/src/dify_sdk/knowledge_base/types/retrieval_model_reranking_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +RetrievalModelRerankingMode = typing.Union[typing.Literal["weighted_score", "reranking_model"], typing.Any] diff --git a/src/dify_sdk/workflow/__init__.py b/src/dify_sdk/workflow/__init__.py index f0517d2..de3f5a5 100644 --- a/src/dify_sdk/workflow/__init__.py +++ b/src/dify_sdk/workflow/__init__.py @@ -16,8 +16,16 @@ GetAppInfoResponse, GetAppParametersResponse, GetAppParametersResponseFileUpload, + GetAppParametersResponseFileUploadAudio, + GetAppParametersResponseFileUploadAudioTransferMethodsItem, + GetAppParametersResponseFileUploadCustom, + GetAppParametersResponseFileUploadCustomTransferMethodsItem, + GetAppParametersResponseFileUploadDocument, + GetAppParametersResponseFileUploadDocumentTransferMethodsItem, GetAppParametersResponseFileUploadImage, GetAppParametersResponseFileUploadImageTransferMethodsItem, + GetAppParametersResponseFileUploadVideo, + GetAppParametersResponseFileUploadVideoTransferMethodsItem, GetAppParametersResponseSystemParameters, GetAppParametersResponseUserInputFormItem, GetAppParametersResponseUserInputFormItemParagraph, @@ -67,8 +75,16 @@ "GetAppInfoResponse", "GetAppParametersResponse", "GetAppParametersResponseFileUpload", + "GetAppParametersResponseFileUploadAudio", + "GetAppParametersResponseFileUploadAudioTransferMethodsItem", + "GetAppParametersResponseFileUploadCustom", + "GetAppParametersResponseFileUploadCustomTransferMethodsItem", + "GetAppParametersResponseFileUploadDocument", + "GetAppParametersResponseFileUploadDocumentTransferMethodsItem", "GetAppParametersResponseFileUploadImage", "GetAppParametersResponseFileUploadImageTransferMethodsItem", + "GetAppParametersResponseFileUploadVideo", + "GetAppParametersResponseFileUploadVideoTransferMethodsItem", "GetAppParametersResponseSystemParameters", "GetAppParametersResponseUserInputFormItem", "GetAppParametersResponseUserInputFormItemParagraph", diff --git a/src/dify_sdk/workflow/client.py b/src/dify_sdk/workflow/client.py index 42009c9..d81da41 100644 --- a/src/dify_sdk/workflow/client.py +++ b/src/dify_sdk/workflow/client.py @@ -42,6 +42,8 @@ def run_workflow( inputs: typing.Dict[str, typing.Optional[typing.Any]], response_mode: RunWorkflowRequestResponseMode, user: str, + files: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[ChunkWorkflowMessage]: """ @@ -73,6 +75,15 @@ def run_workflow( User identifier, used to define the identity of the end user, for easy retrieval and statistics. Rules defined by the developer, the user identifier must be unique within the application. API cannot access sessions created by WebApp. + files : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] + Optional file list + + trace_id : typing.Optional[str] + Tracing ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing. If not specified, the system will automatically generate a `trace_id`. Supports the following three transmission methods, with priorities as follows: + 1. Header: Recommended to pass through HTTP Header `X-Trace-Id`, highest priority. + 2. Query parameter: Pass through URL query parameter `trace_id`. + 3. Request Body: Pass through request body field `trace_id` (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -91,7 +102,12 @@ def run_workflow( yield chunk """ with self._raw_client.run_workflow( - inputs=inputs, response_mode=response_mode, user=user, request_options=request_options + inputs=inputs, + response_mode=response_mode, + user=user, + files=files, + trace_id=trace_id, + request_options=request_options, ) as r: yield from r.data @@ -337,6 +353,8 @@ async def run_workflow( inputs: typing.Dict[str, typing.Optional[typing.Any]], response_mode: RunWorkflowRequestResponseMode, user: str, + files: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[ChunkWorkflowMessage]: """ @@ -368,6 +386,15 @@ async def run_workflow( User identifier, used to define the identity of the end user, for easy retrieval and statistics. Rules defined by the developer, the user identifier must be unique within the application. API cannot access sessions created by WebApp. + files : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] + Optional file list + + trace_id : typing.Optional[str] + Tracing ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing. If not specified, the system will automatically generate a `trace_id`. Supports the following three transmission methods, with priorities as follows: + 1. Header: Recommended to pass through HTTP Header `X-Trace-Id`, highest priority. + 2. Query parameter: Pass through URL query parameter `trace_id`. + 3. Request Body: Pass through request body field `trace_id` (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -389,7 +416,12 @@ async def main() -> None: asyncio.run(main()) """ async with self._raw_client.run_workflow( - inputs=inputs, response_mode=response_mode, user=user, request_options=request_options + inputs=inputs, + response_mode=response_mode, + user=user, + files=files, + trace_id=trace_id, + request_options=request_options, ) as r: async for data in r.data: yield data diff --git a/src/dify_sdk/workflow/raw_client.py b/src/dify_sdk/workflow/raw_client.py index 11cd465..718c3f2 100644 --- a/src/dify_sdk/workflow/raw_client.py +++ b/src/dify_sdk/workflow/raw_client.py @@ -46,6 +46,8 @@ def run_workflow( inputs: typing.Dict[str, typing.Optional[typing.Any]], response_mode: RunWorkflowRequestResponseMode, user: str, + files: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[HttpResponse[typing.Iterator[ChunkWorkflowMessage]]]: """ @@ -77,6 +79,15 @@ def run_workflow( User identifier, used to define the identity of the end user, for easy retrieval and statistics. Rules defined by the developer, the user identifier must be unique within the application. API cannot access sessions created by WebApp. + files : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] + Optional file list + + trace_id : typing.Optional[str] + Tracing ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing. If not specified, the system will automatically generate a `trace_id`. Supports the following three transmission methods, with priorities as follows: + 1. Header: Recommended to pass through HTTP Header `X-Trace-Id`, highest priority. + 2. Query parameter: Pass through URL query parameter `trace_id`. + 3. Request Body: Pass through request body field `trace_id` (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -92,6 +103,8 @@ def run_workflow( "inputs": inputs, "response_mode": response_mode, "user": user, + "files": files, + "trace_id": trace_id, }, headers={ "content-type": "application/json", @@ -793,6 +806,8 @@ async def run_workflow( inputs: typing.Dict[str, typing.Optional[typing.Any]], response_mode: RunWorkflowRequestResponseMode, user: str, + files: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT, + trace_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[ChunkWorkflowMessage]]]: """ @@ -824,6 +839,15 @@ async def run_workflow( User identifier, used to define the identity of the end user, for easy retrieval and statistics. Rules defined by the developer, the user identifier must be unique within the application. API cannot access sessions created by WebApp. + files : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] + Optional file list + + trace_id : typing.Optional[str] + Tracing ID. Suitable for integrating with existing trace components in business systems to achieve end-to-end distributed tracing. If not specified, the system will automatically generate a `trace_id`. Supports the following three transmission methods, with priorities as follows: + 1. Header: Recommended to pass through HTTP Header `X-Trace-Id`, highest priority. + 2. Query parameter: Pass through URL query parameter `trace_id`. + 3. Request Body: Pass through request body field `trace_id` (this field). + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -839,6 +863,8 @@ async def run_workflow( "inputs": inputs, "response_mode": response_mode, "user": user, + "files": files, + "trace_id": trace_id, }, headers={ "content-type": "application/json", diff --git a/src/dify_sdk/workflow/types/__init__.py b/src/dify_sdk/workflow/types/__init__.py index 58e18be..ce5ac8c 100644 --- a/src/dify_sdk/workflow/types/__init__.py +++ b/src/dify_sdk/workflow/types/__init__.py @@ -15,10 +15,26 @@ from .get_app_info_response import GetAppInfoResponse from .get_app_parameters_response import GetAppParametersResponse from .get_app_parameters_response_file_upload import GetAppParametersResponseFileUpload +from .get_app_parameters_response_file_upload_audio import GetAppParametersResponseFileUploadAudio +from .get_app_parameters_response_file_upload_audio_transfer_methods_item import ( + GetAppParametersResponseFileUploadAudioTransferMethodsItem, +) +from .get_app_parameters_response_file_upload_custom import GetAppParametersResponseFileUploadCustom +from .get_app_parameters_response_file_upload_custom_transfer_methods_item import ( + GetAppParametersResponseFileUploadCustomTransferMethodsItem, +) +from .get_app_parameters_response_file_upload_document import GetAppParametersResponseFileUploadDocument +from .get_app_parameters_response_file_upload_document_transfer_methods_item import ( + GetAppParametersResponseFileUploadDocumentTransferMethodsItem, +) from .get_app_parameters_response_file_upload_image import GetAppParametersResponseFileUploadImage from .get_app_parameters_response_file_upload_image_transfer_methods_item import ( GetAppParametersResponseFileUploadImageTransferMethodsItem, ) +from .get_app_parameters_response_file_upload_video import GetAppParametersResponseFileUploadVideo +from .get_app_parameters_response_file_upload_video_transfer_methods_item import ( + GetAppParametersResponseFileUploadVideoTransferMethodsItem, +) from .get_app_parameters_response_system_parameters import GetAppParametersResponseSystemParameters from .get_app_parameters_response_user_input_form_item import GetAppParametersResponseUserInputFormItem from .get_app_parameters_response_user_input_form_item_paragraph import ( @@ -60,8 +76,16 @@ "GetAppInfoResponse", "GetAppParametersResponse", "GetAppParametersResponseFileUpload", + "GetAppParametersResponseFileUploadAudio", + "GetAppParametersResponseFileUploadAudioTransferMethodsItem", + "GetAppParametersResponseFileUploadCustom", + "GetAppParametersResponseFileUploadCustomTransferMethodsItem", + "GetAppParametersResponseFileUploadDocument", + "GetAppParametersResponseFileUploadDocumentTransferMethodsItem", "GetAppParametersResponseFileUploadImage", "GetAppParametersResponseFileUploadImageTransferMethodsItem", + "GetAppParametersResponseFileUploadVideo", + "GetAppParametersResponseFileUploadVideoTransferMethodsItem", "GetAppParametersResponseSystemParameters", "GetAppParametersResponseUserInputFormItem", "GetAppParametersResponseUserInputFormItemParagraph", diff --git a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload.py b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload.py index 5447630..f9af9c0 100644 --- a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload.py +++ b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload.py @@ -4,7 +4,11 @@ import pydantic from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_app_parameters_response_file_upload_audio import GetAppParametersResponseFileUploadAudio +from .get_app_parameters_response_file_upload_custom import GetAppParametersResponseFileUploadCustom +from .get_app_parameters_response_file_upload_document import GetAppParametersResponseFileUploadDocument from .get_app_parameters_response_file_upload_image import GetAppParametersResponseFileUploadImage +from .get_app_parameters_response_file_upload_video import GetAppParametersResponseFileUploadVideo class GetAppParametersResponseFileUpload(UniversalBaseModel): @@ -12,11 +16,31 @@ class GetAppParametersResponseFileUpload(UniversalBaseModel): File upload configuration """ + document: typing.Optional[GetAppParametersResponseFileUploadDocument] = pydantic.Field(default=None) + """ + Document settings + """ + image: typing.Optional[GetAppParametersResponseFileUploadImage] = pydantic.Field(default=None) """ Image settings """ + audio: typing.Optional[GetAppParametersResponseFileUploadAudio] = pydantic.Field(default=None) + """ + Audio settings + """ + + video: typing.Optional[GetAppParametersResponseFileUploadVideo] = pydantic.Field(default=None) + """ + Video settings + """ + + custom: typing.Optional[GetAppParametersResponseFileUploadCustom] = pydantic.Field(default=None) + """ + Custom settings + """ + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: diff --git a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_audio.py b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_audio.py new file mode 100644 index 0000000..e669db1 --- /dev/null +++ b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_audio.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_app_parameters_response_file_upload_audio_transfer_methods_item import ( + GetAppParametersResponseFileUploadAudioTransferMethodsItem, +) + + +class GetAppParametersResponseFileUploadAudio(UniversalBaseModel): + """ + Audio settings + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Audio quantity limit, default 3 + """ + + transfer_methods: typing.Optional[typing.List[GetAppParametersResponseFileUploadAudioTransferMethodsItem]] = ( + pydantic.Field(default=None) + ) + """ + Transfer method list: `remote_url`, `local_file`, must choose one + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_audio_transfer_methods_item.py b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_audio_transfer_methods_item.py new file mode 100644 index 0000000..67e6232 --- /dev/null +++ b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_audio_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetAppParametersResponseFileUploadAudioTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_custom.py b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_custom.py new file mode 100644 index 0000000..3fcd5f3 --- /dev/null +++ b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_custom.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_app_parameters_response_file_upload_custom_transfer_methods_item import ( + GetAppParametersResponseFileUploadCustomTransferMethodsItem, +) + + +class GetAppParametersResponseFileUploadCustom(UniversalBaseModel): + """ + Custom settings + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Custom quantity limit, default 3 + """ + + transfer_methods: typing.Optional[typing.List[GetAppParametersResponseFileUploadCustomTransferMethodsItem]] = ( + pydantic.Field(default=None) + ) + """ + Transfer method list: `remote_url`, `local_file`, must choose one + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_custom_transfer_methods_item.py b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_custom_transfer_methods_item.py new file mode 100644 index 0000000..90d4127 --- /dev/null +++ b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_custom_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetAppParametersResponseFileUploadCustomTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_document.py b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_document.py new file mode 100644 index 0000000..d72a350 --- /dev/null +++ b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_document.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_app_parameters_response_file_upload_document_transfer_methods_item import ( + GetAppParametersResponseFileUploadDocumentTransferMethodsItem, +) + + +class GetAppParametersResponseFileUploadDocument(UniversalBaseModel): + """ + Document settings + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Document quantity limit, default 3 + """ + + transfer_methods: typing.Optional[typing.List[GetAppParametersResponseFileUploadDocumentTransferMethodsItem]] = ( + pydantic.Field(default=None) + ) + """ + Transfer method list: `remote_url`, `local_file`, must choose one + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_document_transfer_methods_item.py b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_document_transfer_methods_item.py new file mode 100644 index 0000000..c66d6c0 --- /dev/null +++ b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_document_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetAppParametersResponseFileUploadDocumentTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_image.py b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_image.py index 014545a..f7e78ed 100644 --- a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_image.py +++ b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_image.py @@ -28,7 +28,7 @@ class GetAppParametersResponseFileUploadImage(UniversalBaseModel): pydantic.Field(default=None) ) """ - Transfer method list + Transfer method list: `remote_url`, `local_file`, must choose one """ if IS_PYDANTIC_V2: diff --git a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_video.py b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_video.py new file mode 100644 index 0000000..14f39d0 --- /dev/null +++ b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_video.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .get_app_parameters_response_file_upload_video_transfer_methods_item import ( + GetAppParametersResponseFileUploadVideoTransferMethodsItem, +) + + +class GetAppParametersResponseFileUploadVideo(UniversalBaseModel): + """ + Video settings + """ + + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether enabled + """ + + number_limits: typing.Optional[int] = pydantic.Field(default=None) + """ + Video quantity limit, default 3 + """ + + transfer_methods: typing.Optional[typing.List[GetAppParametersResponseFileUploadVideoTransferMethodsItem]] = ( + pydantic.Field(default=None) + ) + """ + Transfer method list: `remote_url`, `local_file`, must choose one + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_video_transfer_methods_item.py b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_video_transfer_methods_item.py new file mode 100644 index 0000000..75fcef5 --- /dev/null +++ b/src/dify_sdk/workflow/types/get_app_parameters_response_file_upload_video_transfer_methods_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetAppParametersResponseFileUploadVideoTransferMethodsItem = typing.Union[ + typing.Literal["remote_url", "local_file"], typing.Any +] diff --git a/uv.lock b/uv.lock index ecd449c..30f4c51 100644 --- a/uv.lock +++ b/uv.lock @@ -158,7 +158,7 @@ wheels = [ [[package]] name = "dify-openapi" -version = "1.5.1" +version = "1.6.0" source = { editable = "." } dependencies = [ { name = "httpx" },