Procurize.AI REST API 参考#
使用您的 API 令牌以编程方式访问您的知识库——文档、问卷、RAG 和报告。
适用范围: Procurize.AI API v1
身份验证: 通过X-API-Key请求头传递 API 密钥(参见 API 令牌 进行令牌管理)
基础 URL:https://api.procurize.com
概览#
Procurize.AI REST API 提供对平台关键功能的编程访问。它使您能够将 Procurize.AI 与内部系统集成、自动化知识库管理并构建自定义工作流。
受支持的模块(需令牌认证):
- RagArticle – 管理文档
- RagFaq – 管理 FAQ 条目
- RagQuery – 执行 RAG 查询
身份验证#
所有需要身份验证的端点都必须在请求头中传递 API 令牌。
| Header | Value |
|---|---|
X-API-Key | <YOUR_API_TOKEN> |
示例:
curl -X GET "https://api.procurize.com/v1/..." \
-H "X-API-Key: your-api-token-here"
💡 令牌绑定到您的组织——无需在请求中指定组织 ID。
基础 URL#
所有 REST API 端点均位于以下地址下:
https://api.procurize.com
错误处理#
API 使用标准的 HTTP 状态码。
| Code | Meaning |
|---|---|
200 OK | 请求成功 |
201 Created | 资源创建成功 |
204 No Content | 请求成功,无响应体 |
400 Bad Request | 参数无效或请求格式错误 |
401 Unauthorized | 缺少或无效的 API 令牌 |
403 Forbidden | 令牌没有执行此操作的权限 |
404 Not Found | 资源不存在 |
500 Internal Server Error | 服务器内部错误 |
错误响应包含机器可读的错误代码和人类可读的错误信息。
模块参考#
RagArticle#
GET /questionnaire/rag/articles/summary#
摘要: 首页摘要
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| proj | query | string (uuid) | No | 项目 ID。 |
响应 (200):
{
"active": 5
}
GET /questionnaire/rag/articles/total#
摘要: 文章数量
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| q | query | string | No | 按文章名称或代码过滤。 |
| state | query | array | No | 按状态过滤。 |
| project | query | array | No | 按项目过滤。 |
| type | query | array | No | 按文档类型过滤。 |
响应 (200):
42
GET /questionnaire/rag/articles/list#
摘要: 获取文章列表
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| q | query | string | No | 按文章名称或代码过滤。 |
| state | query | array | No | 按状态过滤。 |
| project | query | array | No | 按项目过滤。 |
| type | query | array | No | 按文档类型过滤。 |
| s | query | string | No | 排序字段。 |
| asc | query | boolean | No | 升序排序。 |
| ps | query | integer (int32) | No | 每页大小。 |
| p | query | integer (int32) | No | 基于 1 的页码。 |
响应 (200):
{
"paging": {
"pageNumber": 1,
"pageSize": 10,
"total": 42,
"totalPages": 5
},
"items": [
{
"code": "ART-001",
"org": "00000000-0000-0000-0000-000000000000",
"id": "00000000-0000-0000-0000-000000000000",
"name": "Article Title",
"description": "Article description",
"documentTypes": [
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "Type Name",
"plural": "Type Names",
"count": 5
}
],
"size": 150,
"revision": {
"id": "00000000-0000-0000-0000-000000000000",
"collectionId": "00000000-0000-0000-0000-000000000000",
"rev": 3,
"date": "2025-01-15T10:30:00Z",
"author": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"authorName": "John Doe",
"analysisSummary": {
"id": "00000000-0000-0000-0000-000000000000",
"initiator": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"created": "2025-01-15T10:30:00Z",
"state": "Completed",
"stateDate": "2025-01-15T10:35:00Z",
"stateDetails": "Analysis completed successfully",
"operationId": "op-12345"
}
},
"type": "Article",
"state": "Active",
"projects": [
"00000000-0000-0000-0000-000000000000"
],
"items": [
"00000000-0000-0000-0000-000000000000"
],
"isShared": false
}
]
}
POST /questionnaire/rag/file-to-md#
摘要: 从文件返回 Markdown 内容
请求体 (multipart/form-data):
{
"url": "https://example.com/file.pdf",
"file": "binary"
}
响应 (200):
"Markdown content from file"
POST /questionnaire/rag/article/create#
摘要: 创建文章
请求体 (multipart/form-data):
{
"code": "ART-001",
"name": "Article Title",
"description": "Article description",
"content": "# Article Content\n\nThis is the article content.",
"url": "https://example.com/file.pdf",
"file": "binary"
}
响应 (200):
{
"code": "ART-001",
"org": "00000000-0000-0000-0000-000000000000",
"id": "00000000-0000-0000-0000-000000000000",
"name": "Article Title",
"description": "Article description",
"documentTypes": null,
"size": 150,
"revision": null,
"type": "Article",
"state": "Active",
"projects": null,
"items": null,
"isShared": false
}
GET /questionnaire/rag/article/check#
摘要: 检查文章是否存在
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 文章代码。 |
响应 (200):
true
GET /questionnaire/rag/article-info#
摘要: 按代码获取文章信息
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 文章代码。 |
响应 (200):
{
"code": "ART-001",
"org": "00000000-0000-0000-0000-000000000000",
"id": "00000000-0000-0000-0000-000000000000",
"name": "Article Title",
"description": "Article description",
"documentTypes": null,
"size": 150,
"revision": null,
"type": "Article",
"state": "Active",
"projects": null,
"items": null,
"isShared": false
}
GET /questionnaire/rag/article#
摘要: 按代码获取文章内容
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 文章代码。 |
| format | query | string | No | 为 true 时返回 HTML 内容;否则返回 Markdown 格式的文章内容。 |
| split | query | boolean | No | 为 true 时返回按 RAG 元素分割的内容。 |
| css | query | boolean | No | 为 true 时返回带 CSS 的 HTML/PDF 内容。 |
响应 (200):
"# Article Title\n\nThis is the article content in Markdown format."
POST /questionnaire/rag/article#
摘要: 更新文章元数据
请求体:
{
"code": "ART-001",
"name": "Updated Article Title",
"description": "Updated description",
"projects": [
"00000000-0000-0000-0000-000000000000"
],
"documentTypes": [
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "Type Name",
"plural": "Type Names"
}
],
"isShared": true,
"state": "Active"
}
响应 (200):
{}
DELETE /questionnaire/rag/article#
摘要: 删除文章
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 文章代码。 |
GET /questionnaire/rag/article/pdf#
摘要: 按代码获取 PDF 形式的文章
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 文章代码。 |
响应 (200):
(pdf binary)
GET /questionnaire/rag/article/content#
摘要: 获取文章内容
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 文章代码。 |
响应 (200):
{
"content": "# Article Title\n\nContent here."
}
POST /questionnaire/rag/article/content#
摘要: 更新文章内容
请求体 (multipart/form-data):
{
"code": "ART-001",
"content": "# Updated Content",
"file": "binary"
}
POST /questionnaire/rag/plural#
摘要: 获取名词的复数形式
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| noun | query | string | No | 需要复数化的名词。 |
响应 (200):
{
"plural": "Articles"
}
POST /questionnaire/rag/article/find-types#
摘要: 使用 AI 分析文章并返回其类型
请求体 (multipart/form-data):
{
"code": "ART-001",
"content": "# Article Content"
}
响应 (200):
[
{
"plural": "Types"
}
]
POST /questionnaire/rag/article/format-with-ai#
摘要: 使用 AI 格式化文章内容
请求体 (multipart/form-data):
{
"code": "ART-001",
"content": "# Article Content"
}
响应 (200):
{
"formattedContent": "# Formatted Article Content"
}
POST /questionnaire/rag/article/improve-on-suggestions#
摘要: 根据建议改进文档
请求体 (multipart/form-data):
{
"suggestions": [
{
"sectionTitle": "Introduction",
"suggestion": "Add more details here."
}
],
"code": "ART-001",
"content": "# Article Content"
}
响应 (200):
{
"improvedContent": "# Improved Content"
}
GET /questionnaire/rag/article/parts#
摘要: 返回文章部件列表
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | query | array | Yes | 文章部件列表。 |
响应 (200):
[
{
"id": "00000000-0000-0000-0000-000000000000",
"code": "part-1",
"title": "Introduction",
"orderNumber": 1,
"content": "Introduction content."
}
]
GET /questionnaire/rag/article/revisions#
摘要: 返回文章修订列表
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 文章代码。 |
响应 (200):
[
{
"id": "00000000-0000-0000-0000-000000000000",
"collectionId": "00000000-0000-0000-0000-000000000000",
"rev": 1,
"date": "2025-01-15T10:30:00Z",
"author": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"authorName": "John Doe",
"analysisSummary": {
"id": "00000000-0000-0000-0000-000000000000",
"initiator": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"created": "2025-01-15T10:30:00Z",
"state": "Completed",
"stateDate": "2025-01-15T10:35:00Z",
"stateDetails": "Analysis completed",
"operationId": "op-12345"
}
}
]
GET /questionnaire/rag/article/revisions/info/{id}#
摘要: 获取文章修订信息
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string (uuid) | Yes | 修订 ID。 |
响应 (200):
{
"id": "00000000-0000-0000-0000-000000000000",
"collectionId": "00000000-0000-0000-0000-000000000000",
"rev": 1,
"date": "2025-01-15T10:30:00Z",
"author": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"authorName": "John Doe",
"analysisSummary": {
"id": "00000000-0000-0000-0000-000000000000",
"initiator": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"created": "2025-01-15T10:30:00Z",
"state": "Completed",
"stateDate": "2025-01-15T10:35:00Z",
"stateDetails": "Analysis completed",
"operationId": "op-12345"
}
}
GET /questionnaire/rag/article/revisions/{id}#
摘要: 获取文章修订内容
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string (uuid) | Yes | 修订 ID。 |
响应 (200):
"# Article Revision Content\n\nPrevious version."
GET /questionnaire/rag/article/analyze#
摘要: 使用 AI 分析文章内容
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 文章代码。 |
| rev | query | integer (int32) | No | 修订号。 |
| force | query | boolean | No | 强制创建新分析并删除已有的未完成分析结果。 |
响应 (200):
{
"id": "00000000-0000-0000-0000-000000000000",
"initiator": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"created": "2025-01-15T10:30:00Z",
"state": "Completed",
"stateDate": "2025-01-15T10:35:00Z",
"stateDetails": "Analysis completed",
"operationId": "op-12345"
}
GET /questionnaire/rag/article/analyze/{id}#
摘要: 获取文章分析结果
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string (uuid) | Yes | 分析 ID。 |
响应 (200):
{
"id": "00000000-0000-0000-0000-000000000000",
"initiator": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"created": "2025-01-15T10:30:00Z",
"state": "Completed",
"stateDate": "2025-01-15T10:35:00Z",
"stateDetails": "Analysis completed",
"operationId": "op-12345",
"fragments": [
"fragment-1",
"fragment-2"
],
"ownInconcies": "Own inconsistencies found",
"ragInconcies": "RAG inconsistencies found",
"proposals": "Improvement proposals"
}
GET /questionnaire/rag/messages/list#
摘要: 列出所有消息
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | query | string (uuid) | Yes | RAG 集合 ID。 |
| item | query | string (uuid) | No | RAG 项目 ID。 |
| message | query | string (uuid) | No | 消息 ID。 |
| asc | query | boolean | No | 升序排序。 |
| ps | query | integer (int32) | No | 每页大小。 |
| p | query | integer (int32) | No | 基于 1 的页码。 |
响应 (200):
{
"paging": {
"pageNumber": 1,
"pageSize": 10,
"total": 5,
"totalPages": 1
},
"items": [
{
"id": "00000000-0000-0000-0000-000000000000",
"replyTo": null,
"questionnaire": null,
"section": null,
"question": null,
"ragCollection": "00000000-0000-0000-0000-000000000000",
"ragItem": "00000000-0000-0000-0000-000000000000",
"targetId": "00000000-0000-0000-0000-000000000000",
"targetType": "Question",
"targetNum": 1,
"author": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"text": "Message content",
"created": "2025-01-15T10:30:00Z",
"updated": "2025-01-15T10:30:00Z",
"replies": 0
}
]
}
POST /questionnaire/rag/messages/add#
摘要: 添加新消息
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | query | string (uuid) | Yes | RAG 集合 ID。 |
| item | query | string (uuid) | No | RAG 项目 ID。 |
| message | query | string (uuid) | No | 要回复的消息 ID。 |
请求体:
{
"text": "New message content"
}
响应 (200):
{
"id": "00000000-0000-0000-0000-000000000000",
"replyTo": null,
"questionnaire": null,
"section": null,
"question": null,
"ragCollection": "00000000-0000-0000-0000-000000000000",
"ragItem": "00000000-0000-0000-0000-000000000000",
"targetId": "00000000-0000-0000-0000-000000000000",
"targetType": "Question",
"targetNum": 1,
"author": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"text": "New message content",
"created": "2025-01-15T10:30:00Z",
"updated": "2025-01-15T10:30:00Z",
"replies": 0
}
POST /questionnaire/rag/message#
摘要: 更新已有消息
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| c | query | string (uuid) | Yes | RAG 集合 ID。 |
| id | query | string (uuid) | Yes | 消息 ID。 |
请求体:
{
"text": "Updated message content"
}
响应 (200):
{
"id": "00000000-0000-0000-0000-000000000000",
"replyTo": null,
"questionnaire": null,
"section": null,
"question": null,
"ragCollection": "00000000-0000-0000-0000-000000000000",
"ragItem": "00000000-0000-0000-0000-000000000000",
"targetId": "00000000-0000-0000-0000-000000000000",
"targetType": "Question",
"targetNum": 1,
"author": {
"id": "user123",
"name": "John Doe",
"email": "john.doe@example.com",
"login": "johndoe",
"ra": true
},
"text": "Updated message content",
"created": "2025-01-15T10:30:00Z",
"updated": "2025-01-15T10:45:00Z",
"replies": 0
}
DELETE /questionnaire/rag/message#
摘要: 删除已有消息
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | query | string (uuid) | Yes | 消息 ID。 |
响应 (200):
{}
RagFaq#
GET /questionnaire/rag/faq-collections/summary#
摘要: 首页摘要
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| proj | query | string (uuid) | No | 项目 ID。 |
响应 (200):
{
"active": 3
}
GET /questionnaire/rag/faq-collections/total#
摘要: FAQ 集合数量
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| q | query | string | No | 按集合名称或代码过滤。 |
| state | query | array | No | 按状态过滤。 |
| project | query | array | No | 按项目过滤。 |
响应 (200):
3
GET /questionnaire/rag/faq-collections/list#
摘要: 获取 FAQ 集合列表
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| q | query | string | No | 按集合名称或代码过滤。 |
| state | query | array | No | 按状态过滤。 |
| project | query | array | No | 按项目过滤。 |
| s | query | string | No | 排序字段。 |
| asc | query | boolean | No | 升序排序。 |
| ps | query | integer (int32) | No | 每页大小。 |
| p | query | integer (int32) | No | 基于 1 的页码。 |
响应 (200):
{
"paging": {
"pageNumber": 1,
"pageSize": 10,
"total": 3,
"totalPages": 1
},
"items": [
{
"code": "FAQ-001",
"org": "00000000-0000-0000-0000-000000000000",
"id": "00000000-0000-0000-0000-000000000000",
"name": "FAQ Collection",
"description": "FAQ collection description",
"documentTypes": null,
"size": 5,
"revision": null,
"type": "Faq",
"state": "Active",
"projects": null,
"items": null,
"isShared": false
}
]
}
GET /questionnaire/rag/faq-collections/find-items#
摘要: 查找 FAQ 条目
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| q | query | string | Yes | 按问题过滤。 |
| project | query | string (uuid) | No | 按项目过滤。 |
| ps | query | integer (int32) | No | 每页大小。 |
| p | query | integer (int32) | No | 基于 1 的页码。 |
响应 (200):
{
"paging": {
"pageNumber": 1,
"pageSize": 10,
"total": 5,
"totalPages": 1
},
"items": [
{
"index": 0,
"question": "What is this product?",
"answer": "This is a great product.",
"comment": "Product FAQ",
"state": "Active"
}
]
}
POST /questionnaire/rag/faq-collection/create#
摘要: 创建新的 FAQ 集合
请求体 (multipart/form-data):
{
"code": "FAQ-001",
"name": "FAQ Collection",
"description": "FAQ collection description",
"content": "Content here",
"file": "binary"
}
响应 (200):
{
"code": "FAQ-001",
"id": "00000000-0000-0000-0000-000000000000",
"name": "FAQ Collection",
"description": "FAQ collection description",
"documentTypes": null,
"size": 5,
"revision": null,
"type": "Faq",
"state": "Active",
"projects": null,
"items": null,
"isShared": false
}
POST /questionnaire/rag/faq-collection#
摘要: 更新 FAQ 集合元数据
请求体:
{
"code": "FAQ-001",
"name": "Updated FAQ Collection",
"description": "Updated description",
"projects": null,
"documentTypes": null,
"isShared": false,
"state": "Active"
}
DELETE /questionnaire/rag/faq-collection#
摘要: 删除 FAQ 集合
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 集合代码。 |
GET /questionnaire/rag/faq-collection#
摘要: 获取 FAQ 集合
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 集合代码。 |
响应 (200):
{
"code": "FAQ-001",
"org": "00000000-0000-0000-0000-000000000000",
"id": "00000000-0000-0000-0000-000000000000",
"name": "FAQ Collection",
"description": "FAQ collection description",
"documentTypes": null,
"size": 5,
"revision": null,
"type": "Faq",
"state": "Active",
"projects": null,
"items": null,
"isShared": false
}
GET /questionnaire/rag/faq-collection/check#
摘要: 检查 FAQ 集合是否存在
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 集合代码。 |
响应 (200):
true
GET /questionnaire/rag/faq-collection/items-total#
摘要: FAQ 条目数量
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 集合代码。 |
| q | query | string | No | 按 FAQ 条目内容过滤。 |
请求体:
["Active", "Default"]
响应 (200):
5
GET /questionnaire/rag/faq-collection/items#
摘要: 获取 FAQ 条目列表
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 集合代码。 |
| q | query | string | No | 按 FAQ 条目内容过滤。 |
| state | query | array | No | 按状态过滤。 |
| s | query | string | No | 排序字段。 |
| asc | query | boolean | No | 升序排序。 |
| ps | query | integer (int32) | No | 每页大小。 |
| p | query | integer (int32) | No | 基于 1 的页码。 |
响应 (200):
{
"paging": {
"pageNumber": 1,
"pageSize": 10,
"total": 5,
"totalPages": 1
},
"items": [
{
"index": 0,
"question": "What is this product?",
"answer": "This is a great product.",
"comment": "Product FAQ",
"state": "Active"
}
]
}
POST /questionnaire/rag/faq-collection/item/create#
摘要: 创建新的 FAQ 条目
请求体:
{
"code": "FAQ-001",
"index": 0,
"question": "What is this product?",
"answer": "This is a great product.",
"comment": "Product FAQ",
"state": "Active"
}
响应 (200):
{
"index": 0,
"question": "What is this product?",
"answer": "This is a great product.",
"comment": "Product FAQ",
"state": "Active"
}
GET /questionnaire/rag/faq-collection/item#
摘要: 获取 FAQ 条目
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 集合代码。 |
| index | query | integer (int32) | Yes | 集合中 FAQ 条目的零基索引。 |
响应 (200):
{
"index": 0,
"question": "What is this product?",
"answer": "This is a great product.",
"comment": "Product FAQ",
"state": "Active"
}
POST /questionnaire/rag/faq-collection/item#
摘要: 更新 FAQ 条目
请求体:
{
"code": "FAQ-001",
"index": 0,
"newIndex": 1,
"question": "Updated question?",
"answer": "Updated answer.",
"comment": "Updated comment",
"state": "Active"
}
DELETE /questionnaire/rag/faq-collection/item#
摘要: 删除 FAQ 条目
参数:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| code | query | string | Yes | 集合代码。 |
| index | query | integer (int32) | Yes | 集合中 FAQ 条目的零基索引。 |
RagQuery#
POST /questionnaire/rag/query#
摘要: 在 RAG 知识库中执行查询
请求体:
{
"project": "00000000-0000-0000-0000-000000000000",
"excludeCollections": [
"00000000-0000-0000-0000-000000000000"
],
"question": "What is this product?",
"yourCompanyName": "Acme Corp",
"yourCompanyAlias": "Acme",
"customerName": "John Doe",
"options": [
"option1",
"option2"
],
"multiselect": false,
"nArticles": 5,
"nFaqs": 3,
"threshold": 0.5,
"debug": false,
"withJustification": true,
"withConfidenceLevel": true,
"withFragments": true,
"nAttempts": 3
}
响应 (200):
{
"attempt": 1,
"preparedQuery": {
"original": "What is this product?",
"enhanced": "What is this product and its features?"
},
"ragItems": [
{
"id": "00000000-0000-0000-0000-000000000000",
"distance": 0.25
}
],
"question": "What is this product?",
"generalInstructions": "Based on the knowledge base, here is the answer:",
"text": "This product is a great solution for your needs.",
"explanation": "The answer was found in multiple sources with high confidence."
}
POST /questionnaire/rag/query-stream#
摘要: 在 RAG 知识库中执行流式查询
请求体:
{
"project": "00000000-0000-0000-0000-000000000000",
"excludeCollections": [
"00000000-0000-0000-0000-000000000000"
],
"question": "What is this product?",
"yourCompanyName": "Acme Corp",
"yourCompanyAlias": "Acme",
"customerName": "John Doe",
"options": [
"option1",
"option2"
],
"multiselect": false,
"nArticles": 5,
"nFaqs": 3,
"threshold": 0.5,
"debug": false,
"withJustification": true,
"withConfidenceLevel": true,
"withFragments": true,
"nAttempts": 3
}
响应 (200):
[
{
"text": "This product is a great solution",
"fragments": [
{
"id": "00000000-0000-0000-0000-000000000000",
"part": 1,
"distance": 0.25,
"type": "Article",
"code": "ART-001",
"title": "Product Title",
"fragment": "Product content fragment"
}
]
},
{
"text": " for your needs.",
"fragments": []
}
]
POST /questionnaire/rag/query-fragments#
摘要: 在 RAG 知识库中查询片段
请求体:
{
"project": "00000000-0000-0000-0000-000000000000",
"exclude_documents": [
"00000000-0000-0000-0000-000000000000"
],
"query": "What is this product?",
"top_k": 5,
"similarity_threshold": 0.5,
"prepare_query": true
}
响应 (200):
{
"results": [
{
"document_id": "00000000-0000-0000-0000-000000000000",
"document_code": "ART-001",
"document_title": "Product Title",
"revision": 3,
"chunk_index": 0,
"content": "Product content fragment",
"metadata": {
"author": "John Doe",
"created_at": "2025-01-15T10:30:00Z",
"last_updated_at": "2025-01-15T10:35:00Z",
"doc_categories": [
"Product",
"Information"
]
},
"similarity_score": 0.85
}
]
}
相关文档#
- API 令牌 – 生成与管理 – 如何创建和管理令牌
- 使用知识库向 AI 提问 – 使用 RAG 查询
