v8

latestOpenAPI 3.0.0Apache 2.0raw.githubusercontent.com2025-10-165266542.4 MB
DigitalOcean-public.v2-new_GradientAI Platform

Create a Knowledge Base

To create a knowledge base, send a POST request to /v2/gen-ai/knowledge_bases.

post/v2/gen-ai/knowledge_bases

Request body

database_idstring

Identifier of the DigitalOcean OpenSearch database this knowledge base will use, optional. If not provided, we create a new database for the knowledge base in the same region as the knowledge base.

embedding_model_uuidstring

Identifier for the embedding model.

namestring

Name of the knowledge base.

project_idstring

Identifier of the DigitalOcean project this knowledge base will belong to.

regionstring

The datacenter region to deploy the knowledge base in.

tagsstring[]

Tags to organize your knowledge base.

vpc_uuidstring

The VPC to deploy the knowledge base database in

Example request

{
  "database_id": "\"12345678-1234-1234-1234-123456789012\"",
  "datasources": [
    {
      "aws_data_source": {
        "bucket_name": "example name",
        "item_path": "example string",
        "key_id": "123e4567-e89b-12d3-a456-426614174000",
        "region": "example string",
        "secret_key": "example string"
      },
      "bucket_name": "example name",
      "bucket_region": "example string",
      "dropbox_data_source": {
        "folder": "example string",
        "refresh_token": "example string"
      },
      "file_upload_data_source": {
        "original_file_name": "example name",
        "size_in_bytes": "12345",
        "stored_object_key": "example string"
      },
      "item_path": "example string",
      "spaces_data_source": {
        "bucket_name": "example name",
        "item_path": "example string",
        "region": "example string"
      },
      "web_crawler_data_source": {
        "base_url": "example string",
        "crawling_option": "UNKNOWN",
        "embed_media": true
      }
    }
  ],
  "embedding_model_uuid": "\"12345678-1234-1234-1234-123456789012\"",
  "name": "\"My Knowledge Base\"",
  "project_id": "\"12345678-1234-1234-1234-123456789012\"",
  "region": "\"tor1\"",
  "tags": [
    "example string"
  ],
  "vpc_uuid": "\"12345678-1234-1234-1234-123456789012\""
}

Response

A successful response.

Example response

{
  "knowledge_base": {
    "added_to_agent_at": "2023-01-01T00:00:00Z",
    "created_at": "2023-01-01T00:00:00Z",
    "database_id": "123e4567-e89b-12d3-a456-426614174000",
    "embedding_model_uuid": "123e4567-e89b-12d3-a456-426614174000",
    "is_public": true,
    "last_indexing_job": {
      "completed_datasources": 123,
      "created_at": "2023-01-01T00:00:00Z",
      "data_source_uuids": [
        "example string"
      ],
      "finished_at": "2023-01-01T00:00:00Z",
      "knowledge_base_uuid": "123e4567-e89b-12d3-a456-426614174000",
      "phase": "BATCH_JOB_PHASE_UNKNOWN",
      "started_at": "2023-01-01T00:00:00Z",
      "status": "INDEX_JOB_STATUS_UNKNOWN",
      "tokens": 123,
      "total_datasources": 123,
      "total_items_failed": "12345",
      "total_items_indexed": "12345",
      "total_items_skipped": "12345",
      "updated_at": "2023-01-01T00:00:00Z",
      "uuid": "123e4567-e89b-12d3-a456-426614174000"
    },
    "name": "example name",
    "project_id": "123e4567-e89b-12d3-a456-426614174000",
    "region": "example string",
    "tags": [
      "example string"
    ],
    "updated_at": "2023-01-01T00:00:00Z",
    "user_id": "12345",
    "uuid": "123e4567-e89b-12d3-a456-426614174000"
  }
}