feat(improve-api-endpoints): Added Datasets and Annotation APIs (#12237)
This commit is contained in:
@@ -439,6 +439,195 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
<Heading
|
||||
url='/datasets/{dataset_id}'
|
||||
method='GET'
|
||||
title='Get knowledge base details by knowledge base ID'
|
||||
name='#view_dataset'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
### Query
|
||||
<Properties>
|
||||
<Property name='dataset_id' type='string' key='dataset_id'>
|
||||
Knowledge Base ID
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
<CodeGroup
|
||||
title="Request"
|
||||
tag="GET"
|
||||
label="/datasets/{dataset_id}"
|
||||
targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}' \
|
||||
--header 'Authorization: Bearer {api_key}'
|
||||
```
|
||||
</CodeGroup>
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"id": "eaedb485-95ac-4ffd-ab1e-18da6d676a2f",
|
||||
"name": "Test Knowledge Base",
|
||||
"description": "",
|
||||
"provider": "vendor",
|
||||
"permission": "only_me",
|
||||
"data_source_type": null,
|
||||
"indexing_technique": null,
|
||||
"app_count": 0,
|
||||
"document_count": 0,
|
||||
"word_count": 0,
|
||||
"created_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
|
||||
"created_at": 1735620612,
|
||||
"updated_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
|
||||
"updated_at": 1735620612,
|
||||
"embedding_model": null,
|
||||
"embedding_model_provider": null,
|
||||
"embedding_available": true,
|
||||
"retrieval_model_dict": {
|
||||
"search_method": "semantic_search",
|
||||
"reranking_enable": false,
|
||||
"reranking_mode": null,
|
||||
"reranking_model": {
|
||||
"reranking_provider_name": "",
|
||||
"reranking_model_name": ""
|
||||
},
|
||||
"weights": null,
|
||||
"top_k": 2,
|
||||
"score_threshold_enabled": false,
|
||||
"score_threshold": null
|
||||
},
|
||||
"tags": [],
|
||||
"doc_form": null,
|
||||
"external_knowledge_info": {
|
||||
"external_knowledge_id": null,
|
||||
"external_knowledge_api_id": null,
|
||||
"external_knowledge_api_name": null,
|
||||
"external_knowledge_api_endpoint": null
|
||||
},
|
||||
"external_retrieval_model": {
|
||||
"top_k": 2,
|
||||
"score_threshold": 0.0,
|
||||
"score_threshold_enabled": null
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
<Heading
|
||||
url='/datasets/{dataset_id}'
|
||||
method='POST'
|
||||
title='Update knowledge base'
|
||||
name='#update_dataset'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
### Query
|
||||
<Properties>
|
||||
<Property name='dataset_id' type='string' key='dataset_id'>
|
||||
Knowledge Base ID
|
||||
</Property>
|
||||
<Property name='indexing_technique' type='string' key='indexing_technique'>
|
||||
Index technique (optional)
|
||||
- <code>high_quality</code> High quality
|
||||
- <code>economy</code> Economy
|
||||
</Property>
|
||||
<Property name='permission' type='string' key='permission'>
|
||||
Permission
|
||||
- <code>only_me</code> Only me
|
||||
- <code>all_team_members</code> All team members
|
||||
- <code>partial_members</code> Partial members
|
||||
</Property>
|
||||
<Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
|
||||
Specified embedding model provider, must be set up in the system first, corresponding to the provider field(Optional)
|
||||
</Property>
|
||||
<Property name='embedding_model' type='string' key='embedding_model'>
|
||||
Specified embedding model, corresponding to the model field(Optional)
|
||||
</Property>
|
||||
<Property name='retrieval_model' type='string' key='retrieval_model'>
|
||||
Specified retrieval model, corresponding to the model field(Optional)
|
||||
</Property>
|
||||
<Property name='partial_member_list' type='array' key='partial_member_list'>
|
||||
Partial member list(Optional)
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
<CodeGroup
|
||||
title="Request"
|
||||
tag="POST"
|
||||
label="/datasets/{dataset_id}"
|
||||
targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "Test Knowledge Base", "indexing_technique": "high_quality", "permission": "only_me", "embedding_model_provider": "zhipuai", "embedding_model": "embedding-3", "retrieval_model": "", "partial_member_list": []}' `}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}' \
|
||||
--header 'Authorization: Bearer {api_key}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{"name": "Test Knowledge Base", "indexing_technique": "high_quality", "permission": "only_me",\
|
||||
"embedding_model_provider": "zhipuai", "embedding_model": "embedding-3", "retrieval_model": "", "partial_member_list": []}'
|
||||
```
|
||||
</CodeGroup>
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"id": "eaedb485-95ac-4ffd-ab1e-18da6d676a2f",
|
||||
"name": "Test Knowledge Base",
|
||||
"description": "",
|
||||
"provider": "vendor",
|
||||
"permission": "only_me",
|
||||
"data_source_type": null,
|
||||
"indexing_technique": "high_quality",
|
||||
"app_count": 0,
|
||||
"document_count": 0,
|
||||
"word_count": 0,
|
||||
"created_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
|
||||
"created_at": 1735620612,
|
||||
"updated_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
|
||||
"updated_at": 1735622679,
|
||||
"embedding_model": "embedding-3",
|
||||
"embedding_model_provider": "zhipuai",
|
||||
"embedding_available": null,
|
||||
"retrieval_model_dict": {
|
||||
"search_method": "semantic_search",
|
||||
"reranking_enable": false,
|
||||
"reranking_mode": null,
|
||||
"reranking_model": {
|
||||
"reranking_provider_name": "",
|
||||
"reranking_model_name": ""
|
||||
},
|
||||
"weights": null,
|
||||
"top_k": 2,
|
||||
"score_threshold_enabled": false,
|
||||
"score_threshold": null
|
||||
},
|
||||
"tags": [],
|
||||
"doc_form": null,
|
||||
"external_knowledge_info": {
|
||||
"external_knowledge_id": null,
|
||||
"external_knowledge_api_id": null,
|
||||
"external_knowledge_api_name": null,
|
||||
"external_knowledge_api_endpoint": null
|
||||
},
|
||||
"external_retrieval_model": {
|
||||
"top_k": 2,
|
||||
"score_threshold": 0.0,
|
||||
"score_threshold_enabled": null
|
||||
},
|
||||
"partial_member_list": []
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
<Heading
|
||||
url='/datasets/{dataset_id}'
|
||||
method='DELETE'
|
||||
@@ -1870,6 +2059,110 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
<Heading
|
||||
url='/workspaces/current/models/model-types/text-embedding'
|
||||
method='GET'
|
||||
title='Get available embedding models'
|
||||
name='#model_type_list'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
### Query
|
||||
<Properties>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
<CodeGroup
|
||||
title="Request"
|
||||
tag="GET"
|
||||
label="/datasets/{dataset_id}"
|
||||
targetCode={`curl --location --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' `}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \
|
||||
--header 'Authorization: Bearer {api_key}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
```
|
||||
</CodeGroup>
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"provider": "zhipuai",
|
||||
"label": {
|
||||
"zh_Hans": "智谱 AI",
|
||||
"en_US": "ZHIPU AI"
|
||||
},
|
||||
"icon_small": {
|
||||
"zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/zh_Hans",
|
||||
"en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/en_US"
|
||||
},
|
||||
"icon_large": {
|
||||
"zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/zh_Hans",
|
||||
"en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/en_US"
|
||||
},
|
||||
"status": "active",
|
||||
"models": [
|
||||
{
|
||||
"model": "embedding-3",
|
||||
"label": {
|
||||
"zh_Hans": "embedding-3",
|
||||
"en_US": "embedding-3"
|
||||
},
|
||||
"model_type": "text-embedding",
|
||||
"features": null,
|
||||
"fetch_from": "predefined-model",
|
||||
"model_properties": {
|
||||
"context_size": 8192
|
||||
},
|
||||
"deprecated": false,
|
||||
"status": "active",
|
||||
"load_balancing_enabled": false
|
||||
},
|
||||
{
|
||||
"model": "embedding-2",
|
||||
"label": {
|
||||
"zh_Hans": "embedding-2",
|
||||
"en_US": "embedding-2"
|
||||
},
|
||||
"model_type": "text-embedding",
|
||||
"features": null,
|
||||
"fetch_from": "predefined-model",
|
||||
"model_properties": {
|
||||
"context_size": 8192
|
||||
},
|
||||
"deprecated": false,
|
||||
"status": "active",
|
||||
"load_balancing_enabled": false
|
||||
},
|
||||
{
|
||||
"model": "text_embedding",
|
||||
"label": {
|
||||
"zh_Hans": "text_embedding",
|
||||
"en_US": "text_embedding"
|
||||
},
|
||||
"model_type": "text-embedding",
|
||||
"features": null,
|
||||
"fetch_from": "predefined-model",
|
||||
"model_properties": {
|
||||
"context_size": 512
|
||||
},
|
||||
"deprecated": false,
|
||||
"status": "active",
|
||||
"load_balancing_enabled": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
<Row>
|
||||
|
||||
Reference in New Issue
Block a user