Python
import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
embedding_response = client.models.embeddings.create(
model_deployment_id="model_deployment_id",
texts=["string"],
)
print(embedding_response.embeddings)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)
func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
embeddingResponse, err := client.Models.Embeddings.New(
context.TODO(),
"model_deployment_id",
sgp.ModelEmbeddingNewParams{
Texts: sgp.F([]string{"string"}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", embeddingResponse.Embeddings)
}curl --request POST \
--url https://api.egp.scale.com/v4/models/{model_deployment_id}/embeddings \
--header 'Content-Type: application/json' \
--data '
{
"texts": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({texts: ['<string>']})
};
fetch('https://api.egp.scale.com/v4/models/{model_deployment_id}/embeddings', 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.egp.scale.com/v4/models/{model_deployment_id}/embeddings",
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([
'texts' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/models/{model_deployment_id}/embeddings")
.header("Content-Type", "application/json")
.body("{\n \"texts\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/models/{model_deployment_id}/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"texts\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"embeddings": [
[
"<string>",
[
123
]
]
],
"tokens_used": 0
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Models
Generate text embedding
Description
Computes the text embeddings for text fragments using the model with the given model_deployment_id.
Details
Users can use this API to execute EMBEDDING type EGP model they have access to. To use this API, pass in the id of a model returned by the V3 Create Model API. An example text embedding request
{
"texts": ["Please compute my embedding vector", "Another text fragment"]
}
POST
/
v4
/
models
/
{model_deployment_id}
/
embeddings
Python
import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
embedding_response = client.models.embeddings.create(
model_deployment_id="model_deployment_id",
texts=["string"],
)
print(embedding_response.embeddings)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)
func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
embeddingResponse, err := client.Models.Embeddings.New(
context.TODO(),
"model_deployment_id",
sgp.ModelEmbeddingNewParams{
Texts: sgp.F([]string{"string"}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", embeddingResponse.Embeddings)
}curl --request POST \
--url https://api.egp.scale.com/v4/models/{model_deployment_id}/embeddings \
--header 'Content-Type: application/json' \
--data '
{
"texts": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({texts: ['<string>']})
};
fetch('https://api.egp.scale.com/v4/models/{model_deployment_id}/embeddings', 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.egp.scale.com/v4/models/{model_deployment_id}/embeddings",
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([
'texts' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/models/{model_deployment_id}/embeddings")
.header("Content-Type", "application/json")
.body("{\n \"texts\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/models/{model_deployment_id}/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"texts\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"embeddings": [
[
"<string>",
[
123
]
]
],
"tokens_used": 0
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}⌘I

