Perform text embedding inference on the service Added in 8.11.0

POST /_inference/text_embedding/{inference_id}

Path parameters

  • inference_id string Required

    The inference Id

Query parameters

  • timeout string

    Specifies the amount of time to wait for the inference request to complete.

    Values are -1 or 0.

application/json

Body

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • text_embedding_bytes array[object]
      Hide text_embedding_bytes attribute Show text_embedding_bytes attribute object
      • embedding array[number] Required

        Text Embedding results containing bytes are represented as Dense Vectors of bytes.

    • text_embedding_bits array[object]
      Hide text_embedding_bits attribute Show text_embedding_bits attribute object
      • embedding array[number] Required

        Text Embedding results containing bytes are represented as Dense Vectors of bytes.

    • text_embedding array[object]
      Hide text_embedding attribute Show text_embedding attribute object
      • embedding array[number] Required

        Text Embedding results are represented as Dense Vectors of floats.

POST /_inference/text_embedding/{inference_id}
POST _inference/text_embedding/my-cohere-endpoint { "input": "The sky above the port was the color of television tuned to a dead channel.", "task_settings": { "input_type": "ingest" } }
curl \ --request POST 'http://api.example.com/_inference/text_embedding/{inference_id}' \ --header "Authorization: $API_KEY" \ --header "Content-Type: application/json" \ --data '"{\n \"input\": \"The sky above the port was the color of television tuned to a dead channel.\",\n \"task_settings\": {\n \"input_type\": \"ingest\"\n }\n}"'
Request example
Run `POST _inference/text_embedding/my-cohere-endpoint` to perform text embedding on the example sentence using the Cohere integration,
{ "input": "The sky above the port was the color of television tuned to a dead channel.", "task_settings": { "input_type": "ingest" } }
Response examples (200)
An abbreviated response from `POST _inference/text_embedding/my-cohere-endpoint`.
{ "text_embedding": [ { "embedding": [ { 0.018569946, -0.036895752, 0.01486969, -0.0045204163, -0.04385376, 0.0075950623, 0.04260254, -0.004005432, 0.007865906, 0.030792236, -0.050476074, 0.011795044, -0.011642456, -0.010070801 } ] } ] }