Skip to main content
POST
/
v2
/
data
/
embedding
Insert Data with Embedding
curl --request POST \
  --url https://{resource_uuid}.api.seahorse.dnotitia.ai/v2/data/embedding \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "data": [
    {
      "id": "random1\\u001E1",
      "metadata": "A",
      "text": "hello"
    },
    {
      "id": "random1\\u001E2",
      "metadata": "B",
      "text": "world"
    }
  ],
  "embedding_config": [
    {
      "embedding_target": "dense_vector",
      "embedding_type": "dense"
    },
    {
      "embedding_target": "sparse_vector",
      "embedding_type": "sparse"
    }
  ],
  "embedding_source": "text"
}
'
{
  "code": 200,
  "data": {
    "elapsed_time": 1,
    "inserted_record_batches": 1,
    "inserted_row_count": 1
  },
  "exception": null,
  "success": true
}

Authorizations

Authorization
string
header
required

Bearer token authentication. Include the token in the Authorization header as 'Bearer '

Body

application/json

If you provide the data to insert into the table in the 'data' field, and set the embedding source and target (using embedding_source and embedding_config), the gateway will automatically generate embeddings for your data and insert the data with the embeddings into the table.

Input limits:

  • Max rows in data: 50
  • Max bytes for embedding_source text per row: 32KB

Primary Key Generation Rules:

  • Format: {Document Id: String}{Record Separator: \RS, ASCII 30}{Chunk Id: Int}
  • Document Id: A hash value for duplicate data detection. Recommended length is around 128 characters.
  • Record Separator: ASCII 30 character (\u001E)
  • Chunk Id: 4-byte unsigned integer (maximum: 2^32-1). Sequential numbers are recommended.
  • Do NOT assign the same primary key value (pk) to different chunks. Each pk must be unique per chunk.
data
any[]
required

List of Data that will be inserted into the table.

embedding_source
string
required

Name of the column to get text for embedding. ex) text, metadata, etc.

embedding_config
object[] | null

Embedding type to use. "dense" or "sparse".

embedding_target
string | null

Name of the column to store the embedding vector. The embedding vector generated from the embedding source will be added to the column specified by the embedding target. The embedding target column must be a vector column. ex) feature, embedding, etc.

Response

Success to insert data with embedding

code
integer<int32>
required

HTTP status code.

Required range: x >= 0
success
boolean
required

Whether the request was successful.

data
object
exception
object