Generate vectors
Generate vector embeddings for input data. This endpoint uses Pinecone's hosted embedding models.
POST /embed
curl --request POST \
--url https://api.pinecone.io/embed \
--header 'Api-Key: <api-key>' \
--header 'X-Pinecone-Api-Version: <x-pinecone-api-version>' \
--header 'Content-Type: application/json' \
--data '{
"model": "multilingual-e5-large",
"parameters": {
"input_type": "passage",
"truncate": "END"
},
"inputs": [
{
"text": "The quick brown fox jumps over the lazy dog."
}
]
}'import requests
url = "https://api.pinecone.io/embed"
payload = {
"model": "multilingual-e5-large",
"parameters": {
"input_type": "passage",
"truncate": "END"
},
"inputs": [
{
"text": "The quick brown fox jumps over the lazy dog."
}
]
}
headers = {
"Api-Key": "<api-key>",
"X-Pinecone-Api-Version": "<x-pinecone-api-version>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {method: "POST", headers: {"Api-Key": "<api-key>", "X-Pinecone-Api-Version": "<x-pinecone-api-version>", "Content-Type": "application/json"}, body: JSON.stringify({
"model": "multilingual-e5-large",
"parameters": {
"input_type": "passage",
"truncate": "END"
},
"inputs": [
{
"text": "The quick brown fox jumps over the lazy dog."
}
]
})};
fetch("https://api.pinecone.io/embed", options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pinecone.io/embed",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"model\":\"multilingual-e5-large\",\"parameters\":{\"input_type\":\"passage\",\"truncate\":\"END\"},\"inputs\":[{\"text\":\"The quick brown fox jumps over the lazy dog.\"}]}",
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"X-Pinecone-Api-Version: <x-pinecone-api-version>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pinecone.io/embed"
payload := strings.NewReader("{\"model\":\"multilingual-e5-large\",\"parameters\":{\"input_type\":\"passage\",\"truncate\":\"END\"},\"inputs\":[{\"text\":\"The quick brown fox jumps over the lazy dog.\"}]}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Api-Key", "<api-key>")
req.Header.Add("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pinecone.io/embed")
.header("Api-Key", "<api-key>")
.header("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
.header("Content-Type", "application/json")
.body("{\"model\":\"multilingual-e5-large\",\"parameters\":{\"input_type\":\"passage\",\"truncate\":\"END\"},\"inputs\":[{\"text\":\"The quick brown fox jumps over the lazy dog.\"}]}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pinecone.io/embed")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<api-key>'
request["X-Pinecone-Api-Version"] = '<x-pinecone-api-version>'
request["Content-Type"] = 'application/json'
request.body = "{\"model\":\"multilingual-e5-large\",\"parameters\":{\"input_type\":\"passage\",\"truncate\":\"END\"},\"inputs\":[{\"text\":\"The quick brown fox jumps over the lazy dog.\"}]}"
response = http.request(request)
puts response.read_body{
"model": "multilingual-e5-large",
"vector_type": "dense",
"data": [
{
"values": [
0.1,
0.2,
0.3
],
"vector_type": null
}
],
"usage": {
"total_tokens": 205
}
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Bad request. The request body included invalid request parameters."
},
"status": 400
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Invalid API key."
},
"status": 401
}{
"error": {
"code": "UNKNOWN",
"message": "Internal server error"
},
"status": 500
}Authorizations
Section titled “Authorizations”Api-KeystringrequiredAn API Key is required to call Pinecone APIs. Get yours from the console.
Headers
Section titled “Headers”X-Pinecone-Api-VersionstringrequiredRequired date-based version header
Generate embeddings for inputs.
modelstringrequiredExample: multilingual-e5-large
The model to use for embedding generation.
parameters?objectAdditional model-specific parameters. Refer to the model guide for available model parameters.
inputsobject[]requiredList of inputs to generate embeddings for.
Show child attributes
text?stringThe text input to generate embeddings for.
Example: The quick brown fox jumps over the lazy dog.
Response
Section titled “Response”200 — OK
Embeddings generated for the input.
modelstringrequiredThe model used to generate the embeddings
Example: multilingual-e5-large
vector_typestringrequiredIndicates whether the response data contains 'dense' or 'sparse' embeddings.
Example: dense
dataobject[]requiredThe embeddings generated for the inputs.
Show child attributes
valuesnumber[]requiredThe dense embedding values.
vector_typestringrequiredIndicates whether this is a 'dense' or 'sparse' embedding.
usageobjectrequiredUsage statistics for the model inference.
Show child attributes
total_tokens?integerTotal number of tokens consumed across all inputs.
Required range: 0 <= x. Example: 205