Store Context

Store Context

post

Embed and store inputs as context, for later retrieval. Inputs are chunked and embedded, and the embeddings are stored in the context database. The context can be used for similarity search.

Authorizations
Body
project_idstringRequired

Unique identifier of your project. Every project is stored as a separate collection in Unibrain, so that all the contexts belonging to a project are grouped together. If you are supplying a new project ID, a new collection will be created for you. You can have a maximum of 4096 unique projects in Unibrain.

input_typestring · enumOptional

Type of input. Currently, only text is supported.

Default: textPossible values:
input_textsstring[] · max: 10Required

Array of input texts. Each input text is chunked and embedded separately. The embeddings are stored in the context database. The context can be used for similarity search.

encrypt_inputsbooleanOptional

Whether to encrypt the input texts before storing them in the context database. If true, you must provide an encryption key. The encryption key is used to encrypt the input texts before storing them in the context database. The encryption key is not stored by Unibrain, so you must store it securely. If you lose the encryption key, you will not be able to decrypt the input texts later.

Default: false
encryption_keystringOptional

Encryption key to use when encrypting the input texts. The encryption key is used to encrypt the input texts before storing them in the context database. The encryption key is not stored by Unibrain, so you must store it securely. If you lose the encryption key, you will not be able to decrypt the input texts later.

Responses
201

Accepted

application/json
post
POST /context HTTP/1.1
Host: api.unibrain.ai
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 157

{
  "project_id": "text",
  "metadata": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  },
  "input_type": "text",
  "input_texts": [
    "text"
  ],
  "encrypt_inputs": false,
  "encryption_key": "text"
}
201

Accepted

{
  "context": {
    "status": 1,
    "message": "Error",
    "timestamp": 1
  },
  "data": {
    "document_ids": [
      "123e4567-e89b-12d3-a456-426614174000"
    ]
  }
}

Last updated