import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});
const completionResponse = await client.models.completions.create('model_deployment_id', {
prompt: 'prompt',
});
console.log(completionResponse.completions);
{
"finish_reason": "<string>",
"prompt_tokens": 0,
"response_tokens": 0,
"completions": [
[
"<any>"
]
],
"choices": [
{
"index": 123,
"logprobs": {
"content": [
{
"token": "<string>",
"bytes": [
123
],
"logprob": 123,
"top_logprobs": [
{
"token": "<string>",
"bytes": [
123
],
"logprob": 123
}
]
}
]
}
}
]
}
Interact with the LLM model using the specified model_deployment_id. The LLM model will generate a text completion based on the provided prompt.
{
"prompt": "What is the capital of France?"
}
import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});
const completionResponse = await client.models.completions.create('model_deployment_id', {
prompt: 'prompt',
});
console.log(completionResponse.completions);
{
"finish_reason": "<string>",
"prompt_tokens": 0,
"response_tokens": 0,
"completions": [
[
"<any>"
]
],
"choices": [
{
"index": 123,
"logprobs": {
"content": [
{
"token": "<string>",
"bytes": [
123
],
"logprob": 123,
"top_logprobs": [
{
"token": "<string>",
"bytes": [
123
],
"logprob": 123
}
]
}
]
}
}
]
}
Successful Response
The response is of type object
.