Skip to main content

Encode::Encode

Generates a vector representation of text or images using the specified embedding model. If the model does not exist or has not been loaded, an error will be returned for that particular data item.

It is recommended that multiple pieces of content are specified in a single request to take advantage of batching, especially when running with an attached GPU. Recommended sizes can be found at embedds/model-details and batching will be automatically done.
----
Not all models support [text, images, image_uris] a breakdown of present support is outlined below:

  • ModelClass_INSTRUCTOR - requires: {text and data.instruction}
  • ModelClass_CLIP - any_of: {text, images}

Request Body required
  • batches object[]

    repeated data items to generate encodings for

  • Array [
  • model_class apiModelClass

    Possible values: [ModelClass_Unknown, ModelClass_CLIP, ModelClass_INSTRUCTOR, ModelClass_E5]

    Default value: ModelClass_Unknown

  • model_name string

    specific name of the model to apply the encoding transformation

  • text object
  • data object[]
  • Array [
  • id string
  • value string
  • bytes byte
  • instruction string
  • ]
  • images object
  • data object[]
  • Array [
  • id string
  • value string
  • bytes byte
  • instruction string
  • ]
  • image_uris object
  • data object[]
  • Array [
  • id string
  • value string
  • bytes byte
  • instruction string
  • ]
  • ]
Responses

A successful response.


Schema
  • results object[]

    list of embedding results corresponding to the ordered content submitted

  • Array [
  • err_message string

    explanation for why the content could not be encoded

  • embedding float[]

    embedding representation of the the content

  • ]
Loading...