cURL
curl --location 'https://api.inworld.ai/ml/v1alpha/embedding:embed' \
--header "Authorization: Basic $INWORLD_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"inputs": [
{
"text": "Hello Inworld!"
}
],
"model": {
"model": "sentence-transformers/paraphrase-multilingual-mpnet-base-v2",
"serviceProvider": "SERVICE_PROVIDER_INWORLD"
}
}'import requests
url = "https://api.inworld.ai/ml/v1alpha/embedding:embed"
headers = {
"Authorization": "Basic <api-key>",
"Content-Type": "application/json"
}
payload = {
"inputs": [
{"text": "Hello Inworld!"}
],
"model": {
"model": "sentence-transformers/paraphrase-multilingual-mpnet-base-v2",
"serviceProvider": "SERVICE_PROVIDER_INWORLD"
}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())const url = 'https://api.inworld.ai/ml/v1alpha/embedding:embed';
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': 'Basic <api-key>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
inputs: [{ text: 'Hello Inworld!' }],
model: {
model: 'sentence-transformers/paraphrase-multilingual-mpnet-base-v2',
serviceProvider: 'SERVICE_PROVIDER_INWORLD',
},
}),
});
const data = await response.json();
console.log(data);{
"embeddings": [
{
"values": [
-0.0034770966,
0.014472961,
-0.0031032562,
0.043792725,
0.033081055,
0.003566742,
-0.048217773,
0.03970337,
0.023040771,
0.006038666
]
}
]
}Embeddings
Create embeddings
Generates embeddings for the given text input.
POST
/
ml
/
v1alpha
/
embedding:embed
cURL
curl --location 'https://api.inworld.ai/ml/v1alpha/embedding:embed' \
--header "Authorization: Basic $INWORLD_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"inputs": [
{
"text": "Hello Inworld!"
}
],
"model": {
"model": "sentence-transformers/paraphrase-multilingual-mpnet-base-v2",
"serviceProvider": "SERVICE_PROVIDER_INWORLD"
}
}'import requests
url = "https://api.inworld.ai/ml/v1alpha/embedding:embed"
headers = {
"Authorization": "Basic <api-key>",
"Content-Type": "application/json"
}
payload = {
"inputs": [
{"text": "Hello Inworld!"}
],
"model": {
"model": "sentence-transformers/paraphrase-multilingual-mpnet-base-v2",
"serviceProvider": "SERVICE_PROVIDER_INWORLD"
}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())const url = 'https://api.inworld.ai/ml/v1alpha/embedding:embed';
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': 'Basic <api-key>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
inputs: [{ text: 'Hello Inworld!' }],
model: {
model: 'sentence-transformers/paraphrase-multilingual-mpnet-base-v2',
serviceProvider: 'SERVICE_PROVIDER_INWORLD',
},
}),
});
const data = await response.json();
console.log(data);{
"embeddings": [
{
"values": [
-0.0034770966,
0.014472961,
-0.0031032562,
0.043792725,
0.033081055,
0.003566742,
-0.048217773,
0.03970337,
0.023040771,
0.006038666
]
}
]
}Authorizations
Should follow the format Basic {credentials}. The {credentials} consists of the Base64-encoded string of the API key and the secret in the format key:secret. You can create a key in one command with the Inworld CLI: inworld workspace add-key.
Body
application/json
Request message for Embed method. Contains the input texts and model configuration for the embeddings request
Response
A successful response message for Embed method
List of embeddings generated from the input messages
Show child attributes
Show child attributes
Was this page helpful?
⌘I