From a29c03153207550a8ad8f1c53a8a93866ee66cd9 Mon Sep 17 00:00:00 2001 From: lcawl <lcawley@elastic.co> Date: Wed, 12 Mar 2025 16:43:15 -0700 Subject: [PATCH 1/2] Draft start --- .../put_mistral/PutMistralRequest.ts | 117 ++++++++++++++++++ .../put_mistral/PutMistralResponse.ts | 24 ++++ .../request/PutMistralRequestExample1.yaml | 15 +++ 3 files changed, 156 insertions(+) create mode 100644 specification/inference/put_mistral/PutMistralRequest.ts create mode 100644 specification/inference/put_mistral/PutMistralResponse.ts create mode 100644 specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml diff --git a/specification/inference/put_mistral/PutMistralRequest.ts b/specification/inference/put_mistral/PutMistralRequest.ts new file mode 100644 index 0000000000..92b0eedb59 --- /dev/null +++ b/specification/inference/put_mistral/PutMistralRequest.ts @@ -0,0 +1,117 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RateLimitSetting } from '@inference/_types/Services' +import { RequestBase } from '@_types/Base' +import { Id } from '@_types/common' + +/** + * Create a Watsonx inference endpoint. + * + * Creates an inference endpoint to perform an inference task with the `watsonxai` service. + * You need an IBM Cloud Databases for Elasticsearch deployment to use the `watsonxai` inference service. + * You can provision one through the IBM catalog, the Cloud Databases CLI plug-in, the Cloud Databases API, or Terraform. + * + * When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. + * After creating the endpoint, wait for the model deployment to complete before using it. + * To verify the deployment status, use the get trained model statistics API. + * Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. + * Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. + * @rest_spec_name inference.put_watsonx + * @availability stack since=8.16.0 stability=stable visibility=public + * @availability serverless stability=stable visibility=public + * @cluster_privileges manage_inference + * @doc_id inference-api-put-watsonx + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_inference/{task_type}/{watsonx_inference_id}' + methods: ['PUT'] + } + ] + path_parts: { + /** + * The task type. + * The only valid task type for the model to perform is `text_embedding`. + */ + task_type: WatsonxTaskType + /** + * The unique identifier of the inference endpoint. + */ + watsonx_inference_id: Id + } + body: { + /** + * The type of service supported for the specified task type. In this case, `watsonxai`. + */ + service: ServiceType + /** + * Settings used to install the inference model. These settings are specific to the `watsonxai` service. + */ + service_settings: WatsonxServiceSettings + } +} + +export enum WatsonxTaskType { + text_embedding +} + +export enum ServiceType { + watsonxai +} + +export class WatsonxServiceSettings { + /** + * A valid API key of your Watsonx account. + * You can find your Watsonx API keys or you can create a new one on the API keys page. + * + * IMPORTANT: You need to provide the API key only once, during the inference model creation. + * The get inference endpoint API does not retrieve your API key. + * After creating the inference model, you cannot change the associated API key. + * If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. + * @ext_doc_id watsonx-api-keys + */ + api_key: string + /** + * A version parameter that takes a version date in the format of `YYYY-MM-DD`. + * For the active version data parameters, refer to the Wastonx documentation. + * @ext_doc_id watsonx-api-version + */ + api_version: string + /** + * The name of the model to use for the inference task. + * Refer to the IBM Embedding Models section in the Watsonx documentation for the list of available text embedding models. + * @ext_doc_id watsonx-api-models + */ + model_id: string + /** + * The identifier of the IBM Cloud project to use for the inference task. + */ + project_id: string + /** + * This setting helps to minimize the number of rate limit errors returned from Watsonx. + * By default, the `watsonxai` service sets the number of requests allowed per minute to 120. + */ + rate_limit?: RateLimitSetting + /** + * The URL of the inference endpoint that you created on Watsonx. + */ + url: string +} diff --git a/specification/inference/put_mistral/PutMistralResponse.ts b/specification/inference/put_mistral/PutMistralResponse.ts new file mode 100644 index 0000000000..d40639b031 --- /dev/null +++ b/specification/inference/put_mistral/PutMistralResponse.ts @@ -0,0 +1,24 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { InferenceEndpointInfo } from '@inference/_types/Services' + +export class Response { + body: InferenceEndpointInfo +} diff --git a/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml b/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml new file mode 100644 index 0000000000..2320487516 --- /dev/null +++ b/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml @@ -0,0 +1,15 @@ +# summary: +description: Run `PUT _inference/text_embedding/watsonx-embeddings` to create an Watonsx inference endpoint that performs a text embedding task. +# method_request: "PUT _inference/text_embedding/watsonx-embeddings" +# type: "request" +value: |- + { + "service": "watsonxai", + "service_settings": { + "api_key": "Watsonx-API-Key", + "url": "Wastonx-URL", + "model_id": "ibm/slate-30m-english-rtrvr", + "project_id": "IBM-Cloud-ID", + "api_version": "2024-03-14" + } + } From f0662e648ddbc2fca6fd35f7f5b4d2d4ef820b52 Mon Sep 17 00:00:00 2001 From: lcawl <lcawley@elastic.co> Date: Mon, 17 Mar 2025 21:28:53 -0700 Subject: [PATCH 2/2] Add Mistral inference details --- output/openapi/elasticsearch-openapi.json | 119 +++++++++ .../elasticsearch-serverless-openapi.json | 119 +++++++++ output/schema/schema-serverless.json | 245 ++++++++++++++++++ output/schema/schema.json | 223 +++++++++++++++- output/typescript/types.ts | 23 ++ specification/_doc_ids/table.csv | 3 + .../_json_spec/inference.put.mistral.json | 35 +++ .../put_mistral/PutMistralRequest.ts | 71 +++-- .../request/PutMistralRequestExample1.yaml | 13 +- 9 files changed, 803 insertions(+), 48 deletions(-) create mode 100644 specification/_json_spec/inference.put.mistral.json diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 9dcae6777d..429b52670c 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -18880,6 +18880,83 @@ "x-state": "Added in 8.18.0" } }, + "/_inference/{task_type}/{mistral_inference_id}": { + "put": { + "tags": [ + "inference" + ], + "summary": "Create a Mistral inference endpoint", + "description": "Creates an inference endpoint to perform an inference task with the `mistral` service.\n\nWhen you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.\nAfter creating the endpoint, wait for the model deployment to complete before using it.\nTo verify the deployment status, use the get trained model statistics API.\nLook for `\"state\": \"fully_allocated\"` in the response and ensure that the `\"allocation_count\"` matches the `\"target_allocation_count\"`.\nAvoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.", + "operationId": "inference-put-mistral", + "parameters": [ + { + "in": "path", + "name": "task_type", + "description": "The task type.\nThe only valid task type for the model to perform is `text_embedding`.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/inference.put_mistral:MistralTaskType" + }, + "style": "simple" + }, + { + "in": "path", + "name": "mistral_inference_id", + "description": "The unique identifier of the inference endpoint.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Id" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "chunking_settings": { + "$ref": "#/components/schemas/inference._types:InferenceChunkingSettings" + }, + "service": { + "$ref": "#/components/schemas/inference.put_mistral:ServiceType" + }, + "service_settings": { + "$ref": "#/components/schemas/inference.put_mistral:MistralServiceSettings" + } + }, + "required": [ + "service", + "service_settings" + ] + }, + "examples": { + "PutMistralRequestExample1": { + "description": "Run `PUT _inference/text_embedding/mistral-embeddings-test` to create a Mistral inference endpoint that performs a text embedding task.", + "value": "{\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\" \n }\n}" + } + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/inference._types:InferenceEndpointInfo" + } + } + } + } + }, + "x-state": "Added in 8.15.0" + } + }, "/_inference/{task_type}/{openai_inference_id}": { "put": { "tags": [ @@ -78844,6 +78921,48 @@ "search" ] }, + "inference.put_mistral:MistralTaskType": { + "type": "string", + "enum": [ + "text_embedding" + ] + }, + "inference.put_mistral:ServiceType": { + "type": "string", + "enum": [ + "mistral" + ] + }, + "inference.put_mistral:MistralServiceSettings": { + "type": "object", + "properties": { + "api_key": { + "externalDocs": { + "url": "https://console.mistral.ai/api-keys/" + }, + "description": "A valid API key of your Mistral account.\nYou can find your Mistral API keys or you can create a new one on the API Keys page.\n\nIMPORTANT: You need to provide the API key only once, during the inference model creation.\nThe get inference endpoint API does not retrieve your API key.\nAfter creating the inference model, you cannot change the associated API key.\nIf you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key.", + "type": "string" + }, + "max_input_tokens": { + "description": "The maximum number of tokens per input before chunking occurs.", + "type": "number" + }, + "model": { + "externalDocs": { + "url": "https://docs.mistral.ai/getting-started/models/" + }, + "description": "The name of the model to use for the inference task.\nRefer to the Mistral models documentation for the list of available text embedding models.", + "type": "string" + }, + "rate_limit": { + "$ref": "#/components/schemas/inference._types:RateLimitSetting" + } + }, + "required": [ + "api_key", + "model" + ] + }, "inference.put_openai:OpenAITaskType": { "type": "string", "enum": [ diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 55c1a05981..7945d6e308 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -10702,6 +10702,83 @@ "x-state": "Added in 8.18.0" } }, + "/_inference/{task_type}/{mistral_inference_id}": { + "put": { + "tags": [ + "inference" + ], + "summary": "Create a Mistral inference endpoint", + "description": "Creates an inference endpoint to perform an inference task with the `mistral` service.\n\nWhen you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.\nAfter creating the endpoint, wait for the model deployment to complete before using it.\nTo verify the deployment status, use the get trained model statistics API.\nLook for `\"state\": \"fully_allocated\"` in the response and ensure that the `\"allocation_count\"` matches the `\"target_allocation_count\"`.\nAvoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.", + "operationId": "inference-put-mistral", + "parameters": [ + { + "in": "path", + "name": "task_type", + "description": "The task type.\nThe only valid task type for the model to perform is `text_embedding`.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/inference.put_mistral:MistralTaskType" + }, + "style": "simple" + }, + { + "in": "path", + "name": "mistral_inference_id", + "description": "The unique identifier of the inference endpoint.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Id" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "chunking_settings": { + "$ref": "#/components/schemas/inference._types:InferenceChunkingSettings" + }, + "service": { + "$ref": "#/components/schemas/inference.put_mistral:ServiceType" + }, + "service_settings": { + "$ref": "#/components/schemas/inference.put_mistral:MistralServiceSettings" + } + }, + "required": [ + "service", + "service_settings" + ] + }, + "examples": { + "PutMistralRequestExample1": { + "description": "Run `PUT _inference/text_embedding/mistral-embeddings-test` to create a Mistral inference endpoint that performs a text embedding task.", + "value": "{\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\" \n }\n}" + } + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/inference._types:InferenceEndpointInfo" + } + } + } + } + }, + "x-state": "Added in 8.15.0" + } + }, "/_inference/{task_type}/{openai_inference_id}": { "put": { "tags": [ @@ -50036,6 +50113,48 @@ "search" ] }, + "inference.put_mistral:MistralTaskType": { + "type": "string", + "enum": [ + "text_embedding" + ] + }, + "inference.put_mistral:ServiceType": { + "type": "string", + "enum": [ + "mistral" + ] + }, + "inference.put_mistral:MistralServiceSettings": { + "type": "object", + "properties": { + "api_key": { + "externalDocs": { + "url": "https://console.mistral.ai/api-keys/" + }, + "description": "A valid API key of your Mistral account.\nYou can find your Mistral API keys or you can create a new one on the API Keys page.\n\nIMPORTANT: You need to provide the API key only once, during the inference model creation.\nThe get inference endpoint API does not retrieve your API key.\nAfter creating the inference model, you cannot change the associated API key.\nIf you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key.", + "type": "string" + }, + "max_input_tokens": { + "description": "The maximum number of tokens per input before chunking occurs.", + "type": "number" + }, + "model": { + "externalDocs": { + "url": "https://docs.mistral.ai/getting-started/models/" + }, + "description": "The name of the model to use for the inference task.\nRefer to the Mistral models documentation for the list of available text embedding models.", + "type": "string" + }, + "rate_limit": { + "$ref": "#/components/schemas/inference._types:RateLimitSetting" + } + }, + "required": [ + "api_key", + "model" + ] + }, "inference.put_openai:OpenAITaskType": { "type": "string", "enum": [ diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index fc6cbfa3d2..17775e6160 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -5180,6 +5180,51 @@ } ] }, + { + "availability": { + "serverless": { + "stability": "stable", + "visibility": "public" + }, + "stack": { + "since": "8.15.0", + "stability": "stable", + "visibility": "public" + } + }, + "description": "Create a Mistral inference endpoint.\n\nCreates an inference endpoint to perform an inference task with the `mistral` service.\n\nWhen you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.\nAfter creating the endpoint, wait for the model deployment to complete before using it.\nTo verify the deployment status, use the get trained model statistics API.\nLook for `\"state\": \"fully_allocated\"` in the response and ensure that the `\"allocation_count\"` matches the `\"target_allocation_count\"`.\nAvoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.", + "docId": "inference-api-put-mistral", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-mistral.html", + "name": "inference.put_mistral", + "privileges": { + "cluster": [ + "manage_inference" + ] + }, + "request": { + "name": "Request", + "namespace": "inference.put_mistral" + }, + "requestBodyRequired": false, + "requestMediaType": [ + "application/json" + ], + "response": { + "name": "Response", + "namespace": "inference.put_mistral" + }, + "responseMediaType": [ + "application/json" + ], + "urls": [ + { + "methods": [ + "PUT" + ], + "path": "/_inference/{task_type}/{mistral_inference_id}" + } + ] + }, { "availability": { "serverless": { @@ -29209,6 +29254,118 @@ }, "specLocation": "inference/put_jinaai/PutJinaAiResponse.ts#L22-L24" }, + { + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "description": "The chunking configuration object.", + "extDocId": "inference-chunking", + "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/inference-apis.html#infer-chunking-config", + "name": "chunking_settings", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "InferenceChunkingSettings", + "namespace": "inference._types" + } + } + }, + { + "description": "The type of service supported for the specified task type. In this case, `mistral`.", + "name": "service", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "ServiceType", + "namespace": "inference.put_mistral" + } + } + }, + { + "description": "Settings used to install the inference model. These settings are specific to the `mistral` service.", + "name": "service_settings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "MistralServiceSettings", + "namespace": "inference.put_mistral" + } + } + } + ] + }, + "description": "Create a Mistral inference endpoint.\n\nCreates an inference endpoint to perform an inference task with the `mistral` service.\n\nWhen you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.\nAfter creating the endpoint, wait for the model deployment to complete before using it.\nTo verify the deployment status, use the get trained model statistics API.\nLook for `\"state\": \"fully_allocated\"` in the response and ensure that the `\"allocation_count\"` matches the `\"target_allocation_count\"`.\nAvoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.", + "examples": { + "PutMistralRequestExample1": { + "description": "Run `PUT _inference/text_embedding/mistral-embeddings-test` to create a Mistral inference endpoint that performs a text embedding task.", + "value": "{\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\" \n }\n}" + } + }, + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "kind": "request", + "name": { + "name": "Request", + "namespace": "inference.put_mistral" + }, + "path": [ + { + "description": "The task type.\nThe only valid task type for the model to perform is `text_embedding`.", + "name": "task_type", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "MistralTaskType", + "namespace": "inference.put_mistral" + } + } + }, + { + "description": "The unique identifier of the inference endpoint.", + "name": "mistral_inference_id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + } + ], + "query": [], + "specLocation": "inference/put_mistral/PutMistralRequest.ts#L28-L77" + }, + { + "body": { + "kind": "value", + "value": { + "kind": "instance_of", + "type": { + "name": "InferenceEndpointInfo", + "namespace": "inference._types" + } + } + }, + "kind": "response", + "name": { + "name": "Response", + "namespace": "inference.put_mistral" + }, + "specLocation": "inference/put_mistral/PutMistralResponse.ts#L22-L24" + }, { "attachedBehaviors": [ "CommonQueryParameters" @@ -103194,6 +103351,32 @@ }, "specLocation": "inference/put_jinaai/PutJinaAiRequest.ts#L101-L106" }, + { + "kind": "enum", + "members": [ + { + "name": "text_embedding" + } + ], + "name": { + "name": "MistralTaskType", + "namespace": "inference.put_mistral" + }, + "specLocation": "inference/put_mistral/PutMistralRequest.ts#L79-L81" + }, + { + "kind": "enum", + "members": [ + { + "name": "mistral" + } + ], + "name": { + "name": "ServiceType", + "namespace": "inference.put_mistral" + }, + "specLocation": "inference/put_mistral/PutMistralRequest.ts#L83-L85" + }, { "kind": "enum", "members": [ @@ -125017,6 +125200,68 @@ ], "specLocation": "inference/put_jinaai/PutJinaAiRequest.ts#L139-L160" }, + { + "kind": "interface", + "name": { + "name": "MistralServiceSettings", + "namespace": "inference.put_mistral" + }, + "properties": [ + { + "description": "A valid API key of your Mistral account.\nYou can find your Mistral API keys or you can create a new one on the API Keys page.\n\nIMPORTANT: You need to provide the API key only once, during the inference model creation.\nThe get inference endpoint API does not retrieve your API key.\nAfter creating the inference model, you cannot change the associated API key.\nIf you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key.", + "extDocId": "mistral-api-keys", + "extDocUrl": "https://console.mistral.ai/api-keys/", + "name": "api_key", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The maximum number of tokens per input before chunking occurs.", + "name": "max_input_tokens", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The name of the model to use for the inference task.\nRefer to the Mistral models documentation for the list of available text embedding models.", + "extDocId": "mistral-api-models", + "extDocUrl": "https://docs.mistral.ai/getting-started/models/", + "name": "model", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "This setting helps to minimize the number of rate limit errors returned from the Mistral API.\nBy default, the `mistral` service sets the number of requests allowed per minute to 240.", + "name": "rate_limit", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "RateLimitSetting", + "namespace": "inference._types" + } + } + } + ], + "specLocation": "inference/put_mistral/PutMistralRequest.ts#L87-L114" + }, { "kind": "interface", "name": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 5ef1336bc4..8e01a83657 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -9894,20 +9894,37 @@ }, { "availability": { + "serverless": { + "stability": "stable", + "visibility": "public" + }, "stack": { + "since": "8.15.0", "stability": "stable", "visibility": "public" } }, - "description": "Configure a Mistral inference endpoint", + "description": "Create a Mistral inference endpoint.\n\nCreates an inference endpoint to perform an inference task with the `mistral` service.\n\nWhen you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.\nAfter creating the endpoint, wait for the model deployment to complete before using it.\nTo verify the deployment status, use the get trained model statistics API.\nLook for `\"state\": \"fully_allocated\"` in the response and ensure that the `\"allocation_count\"` matches the `\"target_allocation_count\"`.\nAvoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.", + "docId": "inference-api-put-mistral", "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-mistral.html", "name": "inference.put_mistral", - "request": null, + "privileges": { + "cluster": [ + "manage_inference" + ] + }, + "request": { + "name": "Request", + "namespace": "inference.put_mistral" + }, "requestBodyRequired": false, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "inference.put_mistral" + }, "responseMediaType": [ "application/json" ], @@ -154482,6 +154499,206 @@ }, "specLocation": "inference/put_jinaai/PutJinaAiRequest.ts#L101-L106" }, + { + "kind": "interface", + "name": { + "name": "MistralServiceSettings", + "namespace": "inference.put_mistral" + }, + "properties": [ + { + "description": "A valid API key of your Mistral account.\nYou can find your Mistral API keys or you can create a new one on the API Keys page.\n\nIMPORTANT: You need to provide the API key only once, during the inference model creation.\nThe get inference endpoint API does not retrieve your API key.\nAfter creating the inference model, you cannot change the associated API key.\nIf you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key.", + "extDocId": "mistral-api-keys", + "extDocUrl": "https://console.mistral.ai/api-keys/", + "name": "api_key", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The maximum number of tokens per input before chunking occurs.", + "name": "max_input_tokens", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The name of the model to use for the inference task.\nRefer to the Mistral models documentation for the list of available text embedding models.", + "extDocId": "mistral-api-models", + "extDocUrl": "https://docs.mistral.ai/getting-started/models/", + "name": "model", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "This setting helps to minimize the number of rate limit errors returned from the Mistral API.\nBy default, the `mistral` service sets the number of requests allowed per minute to 240.", + "name": "rate_limit", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "RateLimitSetting", + "namespace": "inference._types" + } + } + } + ], + "specLocation": "inference/put_mistral/PutMistralRequest.ts#L87-L114" + }, + { + "kind": "enum", + "members": [ + { + "name": "text_embedding" + } + ], + "name": { + "name": "MistralTaskType", + "namespace": "inference.put_mistral" + }, + "specLocation": "inference/put_mistral/PutMistralRequest.ts#L79-L81" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "description": "The chunking configuration object.", + "extDocId": "inference-chunking", + "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/inference-apis.html#infer-chunking-config", + "name": "chunking_settings", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "InferenceChunkingSettings", + "namespace": "inference._types" + } + } + }, + { + "description": "The type of service supported for the specified task type. In this case, `mistral`.", + "name": "service", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "ServiceType", + "namespace": "inference.put_mistral" + } + } + }, + { + "description": "Settings used to install the inference model. These settings are specific to the `mistral` service.", + "name": "service_settings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "MistralServiceSettings", + "namespace": "inference.put_mistral" + } + } + } + ] + }, + "description": "Create a Mistral inference endpoint.\n\nCreates an inference endpoint to perform an inference task with the `mistral` service.\n\nWhen you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.\nAfter creating the endpoint, wait for the model deployment to complete before using it.\nTo verify the deployment status, use the get trained model statistics API.\nLook for `\"state\": \"fully_allocated\"` in the response and ensure that the `\"allocation_count\"` matches the `\"target_allocation_count\"`.\nAvoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.", + "examples": { + "PutMistralRequestExample1": { + "description": "Run `PUT _inference/text_embedding/mistral-embeddings-test` to create a Mistral inference endpoint that performs a text embedding task.", + "value": "{\n \"service\": \"mistral\",\n \"service_settings\": {\n \"api_key\": \"Mistral-API-Key\",\n \"model\": \"mistral-embed\" \n }\n}" + } + }, + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "inference.put_mistral" + }, + "path": [ + { + "description": "The task type.\nThe only valid task type for the model to perform is `text_embedding`.", + "name": "task_type", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "MistralTaskType", + "namespace": "inference.put_mistral" + } + } + }, + { + "description": "The unique identifier of the inference endpoint.", + "name": "mistral_inference_id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + } + ], + "query": [], + "specLocation": "inference/put_mistral/PutMistralRequest.ts#L28-L77" + }, + { + "kind": "response", + "body": { + "kind": "value", + "value": { + "kind": "instance_of", + "type": { + "name": "InferenceEndpointInfo", + "namespace": "inference._types" + } + } + }, + "name": { + "name": "Response", + "namespace": "inference.put_mistral" + }, + "specLocation": "inference/put_mistral/PutMistralResponse.ts#L22-L24" + }, + { + "kind": "enum", + "members": [ + { + "name": "mistral" + } + ], + "name": { + "name": "ServiceType", + "namespace": "inference.put_mistral" + }, + "specLocation": "inference/put_mistral/PutMistralRequest.ts#L83-L85" + }, { "kind": "interface", "name": { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index f0d15e6ba1..dd121bf460 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -13639,6 +13639,29 @@ export type InferencePutJinaaiSimilarityType = 'cosine' | 'dot_product' | 'l2_no export type InferencePutJinaaiTextEmbeddingTask = 'classification' | 'clustering' | 'ingest' | 'search' +export interface InferencePutMistralMistralServiceSettings { + api_key: string + max_input_tokens?: integer + model: string + rate_limit?: InferenceRateLimitSetting +} + +export type InferencePutMistralMistralTaskType = 'text_embedding' + +export interface InferencePutMistralRequest extends RequestBase { + task_type: InferencePutMistralMistralTaskType + mistral_inference_id: Id + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferencePutMistralServiceType + service_settings: InferencePutMistralMistralServiceSettings + } +} + +export type InferencePutMistralResponse = InferenceInferenceEndpointInfo + +export type InferencePutMistralServiceType = 'mistral' + export interface InferencePutOpenaiOpenAIServiceSettings { api_key: string dimensions?: integer diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index f54cbf76ae..df19aeea0b 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -349,6 +349,7 @@ inference-api-put-huggingface,https://www.elastic.co/guide/en/elasticsearch/refe inference-api-put-jinaai,https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-jinaai.html inference-api-put-googlevertexai,https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-google-vertex-ai.html inference-api-put-googleaistudio,https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-google-ai-studio.html +inference-api-put-mistral,https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-mistral.html inference-api-put-openai,https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-openai.html inference-api-put-voyageai,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-voyageai inference-api-put-watsonx,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-watsonx @@ -399,6 +400,8 @@ migrate,https://www.elastic.co/guide/en/elasticsearch/reference/current/migrate- migrate-index-allocation-filters,https://www.elastic.co/guide/en/elasticsearch/reference/current/migrate-index-allocation-filters.html migration-api-deprecation,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-migration-deprecations migration-api-feature-upgrade,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-migration-get-feature-upgrade-status +mistral-api-keys,https://console.mistral.ai/api-keys/ +mistral-api-models,https://docs.mistral.ai/getting-started/models/ ml-apis,https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-ml ml-classification,https://www.elastic.co/guide/en/machine-learning/current/ml-dfa-classification.html ml-close-job,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-close-job diff --git a/specification/_json_spec/inference.put.mistral.json b/specification/_json_spec/inference.put.mistral.json new file mode 100644 index 0000000000..97633b233c --- /dev/null +++ b/specification/_json_spec/inference.put.mistral.json @@ -0,0 +1,35 @@ +{ + "inference.put_mistral": { + "documentation": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-mistral.html", + "description": "Configure a Mistral inference endpoint" + }, + "stability": "stable", + "visibility": "public", + "headers": { + "accept": ["application/json"], + "content_type": ["application/json"] + }, + "url": { + "paths": [ + { + "path": "/_inference/{task_type}/{mistral_inference_id}", + "methods": ["PUT"], + "parts": { + "task_type": { + "type": "string", + "description": "The task type" + }, + "mistral_inference_id": { + "type": "string", + "description": "The inference Id" + } + } + } + ] + }, + "body": { + "description": "The inference endpoint's task and service settings" + } + } +} diff --git a/specification/inference/put_mistral/PutMistralRequest.ts b/specification/inference/put_mistral/PutMistralRequest.ts index 92b0eedb59..4aaa32acb9 100644 --- a/specification/inference/put_mistral/PutMistralRequest.ts +++ b/specification/inference/put_mistral/PutMistralRequest.ts @@ -17,32 +17,34 @@ * under the License. */ -import { RateLimitSetting } from '@inference/_types/Services' +import { + InferenceChunkingSettings, + RateLimitSetting +} from '@inference/_types/Services' import { RequestBase } from '@_types/Base' import { Id } from '@_types/common' +import { integer } from '@_types/Numeric' /** - * Create a Watsonx inference endpoint. + * Create a Mistral inference endpoint. * - * Creates an inference endpoint to perform an inference task with the `watsonxai` service. - * You need an IBM Cloud Databases for Elasticsearch deployment to use the `watsonxai` inference service. - * You can provision one through the IBM catalog, the Cloud Databases CLI plug-in, the Cloud Databases API, or Terraform. + * Creates an inference endpoint to perform an inference task with the `mistral` service. * * When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. * After creating the endpoint, wait for the model deployment to complete before using it. * To verify the deployment status, use the get trained model statistics API. * Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. * Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources. - * @rest_spec_name inference.put_watsonx - * @availability stack since=8.16.0 stability=stable visibility=public + * @rest_spec_name inference.put_mistral + * @availability stack since=8.15.0 stability=stable visibility=public * @availability serverless stability=stable visibility=public * @cluster_privileges manage_inference - * @doc_id inference-api-put-watsonx + * @doc_id inference-api-put-mistral */ export interface Request extends RequestBase { urls: [ { - path: '/_inference/{task_type}/{watsonx_inference_id}' + path: '/_inference/{task_type}/{mistral_inference_id}' methods: ['PUT'] } ] @@ -51,67 +53,62 @@ export interface Request extends RequestBase { * The task type. * The only valid task type for the model to perform is `text_embedding`. */ - task_type: WatsonxTaskType + task_type: MistralTaskType /** * The unique identifier of the inference endpoint. */ - watsonx_inference_id: Id + mistral_inference_id: Id } body: { /** - * The type of service supported for the specified task type. In this case, `watsonxai`. + * The chunking configuration object. + * @ext_doc_id inference-chunking + */ + chunking_settings?: InferenceChunkingSettings + /** + * The type of service supported for the specified task type. In this case, `mistral`. */ service: ServiceType /** - * Settings used to install the inference model. These settings are specific to the `watsonxai` service. + * Settings used to install the inference model. These settings are specific to the `mistral` service. */ - service_settings: WatsonxServiceSettings + service_settings: MistralServiceSettings } } -export enum WatsonxTaskType { +export enum MistralTaskType { text_embedding } export enum ServiceType { - watsonxai + mistral } -export class WatsonxServiceSettings { +export class MistralServiceSettings { /** - * A valid API key of your Watsonx account. - * You can find your Watsonx API keys or you can create a new one on the API keys page. + * A valid API key of your Mistral account. + * You can find your Mistral API keys or you can create a new one on the API Keys page. * * IMPORTANT: You need to provide the API key only once, during the inference model creation. * The get inference endpoint API does not retrieve your API key. * After creating the inference model, you cannot change the associated API key. * If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key. - * @ext_doc_id watsonx-api-keys + * @ext_doc_id mistral-api-keys */ api_key: string /** - * A version parameter that takes a version date in the format of `YYYY-MM-DD`. - * For the active version data parameters, refer to the Wastonx documentation. - * @ext_doc_id watsonx-api-version + * The maximum number of tokens per input before chunking occurs. */ - api_version: string + max_input_tokens?: integer /** * The name of the model to use for the inference task. - * Refer to the IBM Embedding Models section in the Watsonx documentation for the list of available text embedding models. - * @ext_doc_id watsonx-api-models - */ - model_id: string - /** - * The identifier of the IBM Cloud project to use for the inference task. + * Refer to the Mistral models documentation for the list of available text embedding models. + * @ext_doc_id mistral-api-models */ - project_id: string + model: string /** - * This setting helps to minimize the number of rate limit errors returned from Watsonx. - * By default, the `watsonxai` service sets the number of requests allowed per minute to 120. + * This setting helps to minimize the number of rate limit errors returned from the Mistral API. + * By default, the `mistral` service sets the number of requests allowed per minute to 240. */ rate_limit?: RateLimitSetting - /** - * The URL of the inference endpoint that you created on Watsonx. - */ - url: string } diff --git a/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml b/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml index 2320487516..52f173151b 100644 --- a/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml +++ b/specification/inference/put_mistral/examples/request/PutMistralRequestExample1.yaml @@ -1,15 +1,12 @@ # summary: -description: Run `PUT _inference/text_embedding/watsonx-embeddings` to create an Watonsx inference endpoint that performs a text embedding task. -# method_request: "PUT _inference/text_embedding/watsonx-embeddings" +description: Run `PUT _inference/text_embedding/mistral-embeddings-test` to create a Mistral inference endpoint that performs a text embedding task. +# method_request: "PUT _inference/text_embedding/mistral-embeddings-test" # type: "request" value: |- { - "service": "watsonxai", + "service": "mistral", "service_settings": { - "api_key": "Watsonx-API-Key", - "url": "Wastonx-URL", - "model_id": "ibm/slate-30m-english-rtrvr", - "project_id": "IBM-Cloud-ID", - "api_version": "2024-03-14" + "api_key": "Mistral-API-Key", + "model": "mistral-embed" } }