Docs
cortecs.aiDedicated ModelsServerless ModelsLogin
  • Introduction
  • DEDICATED INFERENCE
    • Quickstart
    • Provisioning API
      • Authentication
      • User
      • Instances
      • Models
      • Hardware Types
    • Python client
      • Objects
      • Langchain integration
    • Examples
      • Batch jobs
      • Realtime streams
  • SERVERLESS INFERENCE
    • Quickstart
    • Serverless Routing
    • Playground
    • API Overview
      • Chat Completions
      • Embeddings
      • Models
  • Discord
Powered by GitBook
On this page
  1. SERVERLESS INFERENCE
  2. API Overview

Embeddings

PreviousChat CompletionsNextModels

Last updated 6 days ago

Create an embedding

post

This endpoint creates an embedding using the specified model.

Body

A request object for generating embeddings. This object contains all necessary parameters to generate an embedding from the specified model.

modelstringOptional

The model to use for the embedding.

Example: mistral-embed
inputone ofOptional
stringOptional

A single input to embed.

Example: Please embed this sentence.
or
string[]Optional

A list of inputs to embed.

Example: ["First sentence to embed.","Second sentence to embed."]
preferencestring · enumOptional

The provider preference for handling the request.

Default: balancedExample: balancedPossible values:
encoding_formatstring · enumOptional

The encoding to use for the output.

Default: floatExample: floatPossible values:
Responses
200
An embedding.
application/json
500
Internal server error.
post
POST /api/v1/models/serverless/embeddings HTTP/1.1
Host: cortecs.ai
Content-Type: application/json
Accept: */*
Content-Length: 113

{
  "model": "mistral-embed",
  "input": "Please embed this sentence.",
  "preference": "balanced",
  "encoding_format": "float"
}
{
  "id": "cmpl_1234567890",
  "object": "list",
  "created": 1715155200,
  "provider": "mistral",
  "model": "mistral-embed",
  "data": [
    {
      "index": 0,
      "object": "embedding",
      "embedding": [
        0.1,
        0.2,
        0.3
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 0,
    "total_tokens": 10
  }
}