Endpoints

Embedding

POST /embeddings

Vectorize content with an Isaacus embedding model.

Example

import Isaacus from 'isaacus';

const client = new Isaacus({
  apiKey: process.env['ISAACUS_API_KEY'],
});

const embeddingResponse = await client.embeddings.create({
  model: 'kanon-2-embedder',
  texts: [
    'Are restraints of trade enforceable under English law?',
    'What is a non-compete clause?',
  ],
});

console.log(embeddingResponse.embeddings);

Authorizations

Authorization
string header required

An Isaacus-issued API key passed as a bearer token via the Authorization header in the format Authorization: Bearer YOUR_API_KEY.

Request body

model
string required

The ID of the model to use for embedding.

texts
required

The text or array of texts to embed.

Each text must contain at least one non-whitespace character.

No more than 128 texts can be embedded in a single request.

task

The task the embeddings will be used for.

retrieval/query is meant for queries and statements, and retrieval/document is meant for anything to be retrieved using query embeddings.

If null, which is the default setting, embeddings will not be optimized for any particular task.

overflow_strategy

The strategy to employ when content exceeds the model's maximum input length.

drop_end, which is the default setting, drops tokens from the end of the content exceeding the limit.

If null, an error will be raised if any content exceeds the model's maximum input length.

dimensions

The number of dimensions the embeddings should have, not exceeding the maximum dimensions of the model.

If null, the model's default dimensions will be used.

Response

Embeddings of texts produced by an Isaacus embedding model.

200
{
  "embeddings": [
    {
      "index": 0,
      "embedding": [
        -0.0258,
        0.02062,
        -0.0114
      ]
    },
    {
      "index": 1,
      "embedding": [
        -0.0358,
        -0.0128,
        0.00251
      ]
    }
  ],
  "usage": {
    "input_tokens": 42
  }
}
embeddings
object[] required

The embeddings of the inputs.

index
integer required

The position of the content in the input array of contents, starting from 0 (and, therefore, ending at the number of contents minus 1).

embedding
number[] required

The embedding of the content represented as an array of floating point numbers.

usage
object required

Statistics about the usage of resources in the process of embedding the inputs.

input_tokens
integer required

The number of tokens inputted to the model.

See making requests for authentication, SDK usage, and errors.