Skip to content

Create

Add Data Source to a Knowledge Base
post/v2/gen-ai/knowledge_bases/{knowledge_base_uuid}/data_sources

To add a data source to a knowledge base, send a POST request to /v2/gen-ai/knowledge_bases/{knowledge_base_uuid}/data_sources.

Path Parameters
knowledge_base_uuidstring
Body Parameters
aws_data_sourcebucket_namestringitem_pathstringkey_idstringregionstringsecret_keystringAwsDataSource
optional
knowledge_base_uuidstring
optional
spaces_data_sourcebucket_namestringitem_pathstringregionstringAPISpacesDataSource
optional
web_crawler_data_sourcebase_urlstringcrawling_optionenumembed_mediabooleanAPIWebCrawlerDataSource
optional
Returns
knowledge_base_data_sourceaws_data_sourceobjectbucket_namestringcreated_atstringfile_upload_data_sourceAPIFileUploadDataSourceitem_pathstringlast_datasource_indexing_jobAPIIndexedDataSourcelast_indexing_jobAPIIndexingJobregionstringspaces_data_sourceAPISpacesDataSourceupdated_atstringuuidstringweb_crawler_data_sourceAPIWebCrawlerDataSourceAPIKnowledgeBaseDataSource
optional
Request example cURL
curl https://api.digitalocean.com//v2/gen-ai/knowledge_bases/$KNOWLEDGE_BASE_UUID/data_sources \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $GRADIENTAI_API_KEY" \
    -d '{}'
200 Example
{
  "knowledge_base_data_source": {
    "aws_data_source": {
      "bucket_name": "bucket_name",
      "item_path": "item_path",
      "region": "region"
    },
    "bucket_name": "bucket_name",
    "created_at": "2019-12-27T18:11:19.117Z",
    "file_upload_data_source": {
      "original_file_name": "original_file_name",
      "size_in_bytes": "size_in_bytes",
      "stored_object_key": "stored_object_key"
    },
    "item_path": "item_path",
    "last_datasource_indexing_job": {
      "completed_at": "2019-12-27T18:11:19.117Z",
      "data_source_uuid": "data_source_uuid",
      "error_details": "error_details",
      "error_msg": "error_msg",
      "failed_item_count": "failed_item_count",
      "indexed_file_count": "indexed_file_count",
      "indexed_item_count": "indexed_item_count",
      "removed_item_count": "removed_item_count",
      "skipped_item_count": "skipped_item_count",
      "started_at": "2019-12-27T18:11:19.117Z",
      "status": "DATA_SOURCE_STATUS_UNKNOWN",
      "total_bytes": "total_bytes",
      "total_bytes_indexed": "total_bytes_indexed",
      "total_file_count": "total_file_count"
    },
    "last_indexing_job": {
      "completed_datasources": 0,
      "created_at": "2019-12-27T18:11:19.117Z",
      "data_source_uuids": [
        "string"
      ],
      "finished_at": "2019-12-27T18:11:19.117Z",
      "knowledge_base_uuid": "knowledge_base_uuid",
      "phase": "BATCH_JOB_PHASE_UNKNOWN",
      "started_at": "2019-12-27T18:11:19.117Z",
      "status": "INDEX_JOB_STATUS_UNKNOWN",
      "tokens": 0,
      "total_datasources": 0,
      "updated_at": "2019-12-27T18:11:19.117Z",
      "uuid": "uuid"
    },
    "region": "region",
    "spaces_data_source": {
      "bucket_name": "bucket_name",
      "item_path": "item_path",
      "region": "region"
    },
    "updated_at": "2019-12-27T18:11:19.117Z",
    "uuid": "uuid",
    "web_crawler_data_source": {
      "base_url": "base_url",
      "crawling_option": "UNKNOWN",
      "embed_media": true
    }
  }
}