import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});
const embeddingResponse = await client.models.embeddings.create('model_deployment_id', { texts: ['string'] });
console.log(embeddingResponse.embeddings);
{
"embeddings": [
[
"<any>"
]
],
"tokens_used": 0
}
Computes the text embeddings for text fragments using the model with the given model_deployment_id.
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"]
}
import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});
const embeddingResponse = await client.models.embeddings.create('model_deployment_id', { texts: ['string'] });
console.log(embeddingResponse.embeddings);
{
"embeddings": [
[
"<any>"
]
],
"tokens_used": 0
}
Successful Response
The response is of type object
.