Generate vectors
curl --request POST \
--url https://api.pinecone.io/embed \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: application/json' \
--header 'X-Pinecone-Api-Version: <x-pinecone-api-version>' \
--data '
{
"model": "multilingual-e5-large",
"inputs": [
{
"text": "The quick brown fox jumps over the lazy dog."
}
],
"parameters": {
"input_type": "passage",
"truncate": "END"
}
}
'import requests
url = "https://api.pinecone.io/embed"
payload = {
"model": "multilingual-e5-large",
"inputs": [{ "text": "The quick brown fox jumps over the lazy dog." }],
"parameters": {
"input_type": "passage",
"truncate": "END"
}
}
headers = {
"X-Pinecone-Api-Version": "<x-pinecone-api-version>",
"Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Pinecone-Api-Version': '<x-pinecone-api-version>',
'Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'multilingual-e5-large',
inputs: [{text: 'The quick brown fox jumps over the lazy dog.'}],
parameters: {input_type: 'passage', truncate: 'END'}
})
};
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_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'multilingual-e5-large',
'inputs' => [
[
'text' => 'The quick brown fox jumps over the lazy dog.'
]
],
'parameters' => [
'input_type' => 'passage',
'truncate' => 'END'
]
]),
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"Content-Type: application/json",
"X-Pinecone-Api-Version: <x-pinecone-api-version>"
],
]);
$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("{\n \"model\": \"multilingual-e5-large\",\n \"inputs\": [\n {\n \"text\": \"The quick brown fox jumps over the lazy dog.\"\n }\n ],\n \"parameters\": {\n \"input_type\": \"passage\",\n \"truncate\": \"END\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
req.Header.Add("Api-Key", "<api-key>")
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("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"multilingual-e5-large\",\n \"inputs\": [\n {\n \"text\": \"The quick brown fox jumps over the lazy dog.\"\n }\n ],\n \"parameters\": {\n \"input_type\": \"passage\",\n \"truncate\": \"END\"\n }\n}")
.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["X-Pinecone-Api-Version"] = '<x-pinecone-api-version>'
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"multilingual-e5-large\",\n \"inputs\": [\n {\n \"text\": \"The quick brown fox jumps over the lazy dog.\"\n }\n ],\n \"parameters\": {\n \"input_type\": \"passage\",\n \"truncate\": \"END\"\n }\n}"
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": "<string>"
}
],
"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
}Inference
Generate vectors
Generate vector embeddings for input data. This endpoint uses Pinecone’s hosted embedding models.
POST
/
embed
Generate vectors
curl --request POST \
--url https://api.pinecone.io/embed \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: application/json' \
--header 'X-Pinecone-Api-Version: <x-pinecone-api-version>' \
--data '
{
"model": "multilingual-e5-large",
"inputs": [
{
"text": "The quick brown fox jumps over the lazy dog."
}
],
"parameters": {
"input_type": "passage",
"truncate": "END"
}
}
'import requests
url = "https://api.pinecone.io/embed"
payload = {
"model": "multilingual-e5-large",
"inputs": [{ "text": "The quick brown fox jumps over the lazy dog." }],
"parameters": {
"input_type": "passage",
"truncate": "END"
}
}
headers = {
"X-Pinecone-Api-Version": "<x-pinecone-api-version>",
"Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Pinecone-Api-Version': '<x-pinecone-api-version>',
'Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'multilingual-e5-large',
inputs: [{text: 'The quick brown fox jumps over the lazy dog.'}],
parameters: {input_type: 'passage', truncate: 'END'}
})
};
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_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'multilingual-e5-large',
'inputs' => [
[
'text' => 'The quick brown fox jumps over the lazy dog.'
]
],
'parameters' => [
'input_type' => 'passage',
'truncate' => 'END'
]
]),
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"Content-Type: application/json",
"X-Pinecone-Api-Version: <x-pinecone-api-version>"
],
]);
$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("{\n \"model\": \"multilingual-e5-large\",\n \"inputs\": [\n {\n \"text\": \"The quick brown fox jumps over the lazy dog.\"\n }\n ],\n \"parameters\": {\n \"input_type\": \"passage\",\n \"truncate\": \"END\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
req.Header.Add("Api-Key", "<api-key>")
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("X-Pinecone-Api-Version", "<x-pinecone-api-version>")
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"multilingual-e5-large\",\n \"inputs\": [\n {\n \"text\": \"The quick brown fox jumps over the lazy dog.\"\n }\n ],\n \"parameters\": {\n \"input_type\": \"passage\",\n \"truncate\": \"END\"\n }\n}")
.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["X-Pinecone-Api-Version"] = '<x-pinecone-api-version>'
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"multilingual-e5-large\",\n \"inputs\": [\n {\n \"text\": \"The quick brown fox jumps over the lazy dog.\"\n }\n ],\n \"parameters\": {\n \"input_type\": \"passage\",\n \"truncate\": \"END\"\n }\n}"
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": "<string>"
}
],
"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
Headers
Required date-based version header
Body
application/json
Generate embeddings for inputs.
List of inputs to generate embeddings for.
Show child attributes
Show child attributes
Additional model-specific parameters. Refer to the model guide for available model parameters.
Example:
{
"input_type": "passage",
"truncate": "END"
}
Response
OK
Embeddings generated for the input.
The model used to generate the embeddings
Example:
"multilingual-e5-large"
Indicates whether the response data contains 'dense' or 'sparse' embeddings.
Example:
"dense"
The embeddings generated for the inputs.
A dense embedding of a single input
- Dense embedding
- Sparse embedding
Show child attributes
Show child attributes
Usage statistics for the model inference.
Show child attributes
Show child attributes
Was this page helpful?