POST
/
embeddings
curl --request POST \
  --url https://api.carbon.ai/embeddings \
  --header 'Content-Type: application/json' \
  --header 'authorization: <api-key>' \
  --data '{
  "query": "<string>",
  "query_vector": [
    123
  ],
  "k": 2,
  "file_ids": [
    123
  ],
  "parent_file_ids": [
    123
  ],
  "include_all_children": true,
  "tags": {},
  "tags_v2": {
    "OR": [
      {
        "key": "subject",
        "negate": false,
        "value": "holy-bible"
      },
      {
        "key": "person-of-interest",
        "negate": false,
        "value": "jesus christ"
      },
      {
        "key": "genre",
        "negate": true,
        "value": "fiction"
      },
      {
        "AND": [
          {
            "key": "subject",
            "negate": true,
            "value": "tao-te-ching"
          },
          {
            "key": "author",
            "negate": false,
            "value": "lao-tzu"
          }
        ]
      }
    ]
  },
  "include_tags": true,
  "include_vectors": true,
  "include_raw_file": true,
  "hybrid_search": true,
  "hybrid_search_tuning_parameters": {
    "weight_a": 0.5,
    "weight_b": 0.5
  },
  "media_type": "TEXT",
  "embedding_model": "OPENAI"
}'
{
  "documents": [
    {
      "content": "<string>",
      "file_id": 123,
      "source": "<string>",
      "source_url": "<string>",
      "source_type": "GOOGLE_DRIVE",
      "presigned_url": "<string>",
      "tags": {},
      "vector": [
        123
      ],
      "score": 123,
      "rank": 123,
      "content_metadata": {},
      "chunk_index": 123
    }
  ]
}

Authorizations

authorization
string
headerrequired

token <token>, corresponds to temporary access tokens.

Body

application/json
query
string
required

Query for which to get related chunks and embeddings.

query_vector
number[] | null

Optional query vector for which to get related chunks and embeddings. It must have been generated by the same model used to generate the embeddings across which the search is being conducted. Cannot provide both query and query_vector.

k
integer
required

Number of related chunks to return.

file_ids
integer[] | null

Optional list of file IDs to limit the search to

parent_file_ids
integer[] | null
deprecated

Optional list of parent file IDs to limit the search to. A parent file describes a file to which another file belongs (e.g. a folder)

include_all_children
boolean
default: false

Flag to control whether or not to include all children of filtered files in the embedding search.

tags
object | null

A set of tags to limit the search to. Deprecated and may be removed in the future.

tags_v2
object | null

A set of tags to limit the search to. Use this instead of tags, which is deprecated.

include_tags
boolean | null

Flag to control whether or not to include tags for each chunk in the response.

include_vectors
boolean | null

Flag to control whether or not to include embedding vectors in the response.

include_raw_file
boolean | null

Flag to control whether or not to include a signed URL to the raw file containing each chunk in the response.

hybrid_search
boolean | null

Flag to control whether or not to perform hybrid search.

hybrid_search_tuning_parameters
object | null

Hybrid search tuning parameters. See the endpoint description for more details.

media_type
enum<string> | null

Used to filter the kind of files (e.g. TEXT or IMAGE) over which to perform the search. Also plays a role in determining what embedding model is used to embed the query. If IMAGE is chosen as the media type, then the embedding model used will be an embedding model that is not text-only, regardless of what value is passed for embedding_model.

Available options:
TEXT,
IMAGE
embedding_model
enum<string> | null

Embedding model that should be used to embed the query. For this to be effective, the files being searched must also have embeddings in Carbon that were generated by the same embedding model.

Available options:
OPENAI,
AZURE_OPENAI,
AZURE_ADA_LARGE_256,
AZURE_ADA_LARGE_1024,
AZURE_ADA_LARGE_3072,
AZURE_ADA_SMALL_512,
AZURE_ADA_SMALL_1536,
COHERE_MULTILINGUAL_V3,
VERTEX_MULTIMODAL,
OPENAI_ADA_LARGE_256,
OPENAI_ADA_LARGE_1024,
OPENAI_ADA_LARGE_3072,
OPENAI_ADA_SMALL_512,
OPENAI_ADA_SMALL_1536

Response

200 - application/json
documents
object[]
required