İçeriğe geç
Gurubase Siper
English
Esc
navigateopen⌘Jpreview

Create an embedding vector

Compatible with OpenAI POST /v1/embeddings. input may be a single string or an array of strings; when masking is on, personal fields detected in the text are replaced with placeholders before the vector is computed. The returned vector is therefore the vector of the masked text.

Two consequences follow, and both should be known upfront:

  • The same document always yields the same vector. Placeholders on this endpoint are deterministic (<PERSON_1>), so re-embedding a document keeps your index consistent.
  • Masked entities cannot be told apart. Two documents that differ only in a person’s name produce the same vector (measured: similarity 1.000), and a query naming a person scores both equally. Search does not fail; it returns the wrong person’s document just as readily. Topic search is unaffected. Indexing and querying must go through the same path.

Pre-tokenized input (an array of token ids) is not text and cannot be masked, so it is rejected fail-closed with 415.

POST/v1/embeddings
Request body
requiredapplication/json
modelstringrequired
Embedding model id (defined in the panel).
inputstring | string[]required
Text or array of texts to embed. Token id arrays are not accepted (they cannot be masked and are rejected with 415).
Show properties
One of:
string
string
string[]
Array of string
string
dimensionsinteger
Output vector size, when the model supports it.
min 1
encoding_formatstring
default: "float"
Allowed:floatbase64
Responses
200List of vectors
objectstring
modelstring
dataobject[]
Show properties
Array of object
objectstring
indexinteger
embeddingnumber[] | string<byte>
A number array when `encoding_format` is the default (`float`); a base64-encoded STRING when `base64` is requested. Your client must handle both shapes.
Show properties
One of:
number[]
Array of number
number
string<byte>
string<byte>
usageobject
Show properties
prompt_tokensinteger
total_tokensinteger
401Missing or invalid virtual key
errorobject
Show properties
messagestring
typestring
413Input exceeds the masking limit. The request is not forwarded; split the text and retry.
errorobject
Show properties
messagestring
typestring
415Input is pre-tokenized (an array of token ids). It is not text and cannot be masked, so the request is **fail-closed** and never reaches the provider. Send text instead.
errorobject
Show properties
messagestring
typestring
429Quota or rate limit exceeded
errorobject
Show properties
messagestring
typestring
502The masking step could not run. The request is **fail-closed** and never reaches the provider; there is no "send it unmasked" option.
errorobject
Show properties
messagestring
typestring
Request
import requests

response = requests.post(
    "https://gw-tr.gurubase.io/v1/embeddings",
    headers={
        "Content-Type": "application/json"
    },
    json={
  "model": "text-embedding-3-small",
  "input": "string",
  "dimensions": 0,
  "encoding_format": "float"
},
)
Response
{
  "object": "list",
  "model": "text-embedding-3-small",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [
        0
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "total_tokens": 0
  }
}