Create a AI21 inference endpoint
Generally available
Path parameters
-
The type of the inference task that the model will perform.
Values are
completion
orchat_completion
. -
The unique identifier of the inference endpoint.
Query parameters
-
Specifies the amount of time to wait for the inference endpoint to be created.
Values are
-1
or0
.
PUT
/_inference/{task_type}/{ai21_inference_id}
Console
PUT _inference/completion/ai21-completion
{
"service": "ai21",
"service_settings": {
"api_key": "ai21-api-key",
"model_id": "jamba-large"
}
}
resp = client.inference.put(
task_type="completion",
inference_id="ai21-completion",
inference_config={
"service": "ai21",
"service_settings": {
"api_key": "ai21-api-key",
"model_id": "jamba-large"
}
},
)
const response = await client.inference.put({
task_type: "completion",
inference_id: "ai21-completion",
inference_config: {
service: "ai21",
service_settings: {
api_key: "ai21-api-key",
model_id: "jamba-large",
},
},
});
response = client.inference.put(
task_type: "completion",
inference_id: "ai21-completion",
body: {
"service": "ai21",
"service_settings": {
"api_key": "ai21-api-key",
"model_id": "jamba-large"
}
}
)
$resp = $client->inference()->put([
"task_type" => "completion",
"inference_id" => "ai21-completion",
"body" => [
"service" => "ai21",
"service_settings" => [
"api_key" => "ai21-api-key",
"model_id" => "jamba-large",
],
],
]);
curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"service":"ai21","service_settings":{"api_key":"ai21-api-key","model_id":"jamba-large"}}' "$ELASTICSEARCH_URL/_inference/completion/ai21-completion"
Request examples
Put ai21 request example1
Run `PUT _inference/completion/ai21-completion` to create an AI21 inference endpoint that performs a `completion` task.
{
"service": "ai21",
"service_settings": {
"api_key": "ai21-api-key",
"model_id": "jamba-large"
}
}
Run `PUT _inference/chat-completion/ai21-chat-completion` to create a AI21 inference endpoint that performs a `chat_completion` task.
{
"service": "ai21",
"service_settings": {
"api_key": "ai21-api-key",
"model_id": "jamba-mini"
}
}