Create Knowledge Base

Create Knowledge Base

This method allows you to create a new knowledge base.

A knowledge base can be created using one of two types: a knowledge base can either be linked to data sources (by using data_origin_type=DATA_SOURCES), or it can be maintained independently of data sources (by using data_origin_type=LOCAL_FILES).

If a knowledge base is linked to one or more data sources, it is automatically filled with data by crawling and retrieving documents from the linked data sources. If documents are added or removed from a data source, the indexes of the knowledge base are updated automatically when an indexing is triggered. An indexing can be triggered explicitly via the API, or it can be configured to happen periodically using an index_refresh_policy.

Otherwise, if a knowledge base not linked, you can maintain the knowledge base contents yourself. You can add documents by uploading them via the API, and uploaded documents can be removed using the API.

Note that the type of knowledge base cannot be changed after the creation, and it is not possible to mix the two types (e.g., link a knowledge base to a set of data sources and also upload files via the API).

Request
URI
POST
https://{api_host}/api/v1/control/knowledge-bases
COPY
Request Body
KnowledgeBaseCreateRequest of type(s) application/json
Required

Show optional properties

{
    "data_origin_type": "string"
}
{
    "name": "string",
    "description": "string",
    "data_origin_type": "string"
}
string
name
Optional
Constraints: maxLength: 256

Name of the knowledge base.

string
description
Optional

Description of the knowledge base.

index_refresh_policy
Required

Policy defining when to refresh the index of the knowledge base.

string
data_origin_type
Required

data_origin_type

Possible values are : DATA_SOURCES, LOCAL_FILES,
Authentication
This operation uses the following authentication methods.
Responses
201

Successful Response

Returns KnowledgeBase of type(s) application/json
"KnowledgeBase Object"
string As uuid As uuid
id
Required

ID of the knowledge base.

string
name
Optional
Constraints: maxLength: 256

Name of the knowledge base.

string
description
Optional

Description of the knowledge base.

index_refresh_policy
Required

Policy defining when to refresh the index of the knowledge base.

string
data_origin_type
Required

data_origin_type

Possible values are : DATA_SOURCES, LOCAL_FILES,
string
object
Optional
Constraints: default: knowledge_base

Object type, which is always knowledge_base.

integer
created_at
Required

Unix timestamp (in seconds) when the knowledge base was created.

integer
last_updated_at
Required

Unix timestamp (in seconds) when the knowledge base was last updated.

integer
next_index_refresh_at
Optional

Unix timestamp (in seconds) of the next scheduled indexing.


400

Unsupported configuration of knowledge base.

Operation doesn't return any data structure

422

Validation Error

Returns HTTPValidationError of type(s) application/json
"HTTPValidationError Object"
array of object
detail
Optional

detail


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"index_refresh_policy":"{}","data_origin_type:"string"}' https://{api_host}/api/v1/control/knowledge-bases