diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 89dc0b479..06cb8cf1f 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -5106,7 +5106,12 @@ To override the default behavior, you can set the `esql.query.allow_partial_resu It is valid only for the CSV format. ** *`drop_null_columns` (Optional, boolean)*: Indicates whether columns that are entirely `null` will be removed from the `columns` and `values` portion of the results. If `true`, the response will include an extra section under the name `all_columns` which has the name of all the columns. -** *`format` (Optional, Enum("csv" | "json" | "tsv" | "txt" | "yaml" | "cbor" | "smile" | "arrow"))*: A short version of the Accept header, for example `json` or `yaml`. +** *`format` (Optional, Enum("csv" | "json" | "tsv" | "txt" | "yaml" | "cbor" | "smile" | "arrow"))*: A short version of the Accept header, e.g. json, yaml. + +`csv`, `tsv`, and `txt` formats will return results in a tabular format, excluding other metadata fields from the response. + +For async requests, nothing will be returned if the async query doesn't finish within the timeout. +The query ID and running status are available in the `X-Elasticsearch-Async-Id` and `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively. [discrete] ==== async_query_delete @@ -5215,6 +5220,8 @@ name and the next level key is the column name. object with information about the clusters that participated in the search along with info such as shards count. ** *`format` (Optional, Enum("csv" | "json" | "tsv" | "txt" | "yaml" | "cbor" | "smile" | "arrow"))*: A short version of the Accept header, e.g. json, yaml. + +`csv`, `tsv`, and `txt` formats will return results in a tabular format, excluding other metadata fields from the response. ** *`delimiter` (Optional, string)*: The character to use between values within a CSV row. Only valid for the CSV format. ** *`drop_null_columns` (Optional, boolean)*: Should columns that are entirely `null` be removed from the `columns` and `values` portion of the results? Defaults to `false`. If `true` then the response will include an extra section under the name `all_columns` which has the name of all columns. @@ -8196,6 +8203,7 @@ However, if you do not plan to use the inference APIs to use these models or if The following integrations are available through the inference API. You can find the available task types next to the integration name: * AlibabaCloud AI Search (`completion`, `rerank`, `sparse_embedding`, `text_embedding`) * Amazon Bedrock (`completion`, `text_embedding`) +* Amazon SageMaker (`chat_completion`, `completion`, `rerank`, `sparse_embedding`, `text_embedding`) * Anthropic (`completion`) * Azure AI Studio (`completion`, `text_embedding`) * Azure OpenAI (`completion`, `text_embedding`) @@ -8282,12 +8290,29 @@ These settings are specific to the task type you specified. [discrete] ==== put_amazonsagemaker -Configure a Amazon SageMaker inference endpoint +Create an Amazon SageMaker inference endpoint. + +Create an inference endpoint to perform an inference task with the `amazon_sagemaker` service. + +https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-amazonsagemaker[Endpoint documentation] [source,ts] ---- -client.inference.putAmazonsagemaker() +client.inference.putAmazonsagemaker({ task_type, amazonsagemaker_inference_id, service, service_settings }) ---- +[discrete] +==== Arguments + +* *Request (object):* +** *`task_type` (Enum("text_embedding" | "completion" | "chat_completion" | "sparse_embedding" | "rerank"))*: The type of the inference task that the model will perform. +** *`amazonsagemaker_inference_id` (string)*: The unique identifier of the inference endpoint. +** *`service` (Enum("amazon_sagemaker"))*: The type of service supported for the specified task type. In this case, `amazon_sagemaker`. +** *`service_settings` ({ access_key, endpoint_name, api, region, secret_key, target_model, target_container_hostname, inference_component_name, batch_size, dimensions })*: Settings used to install the inference model. +These settings are specific to the `amazon_sagemaker` service and `service_settings.api` you specified. +** *`chunking_settings` (Optional, { max_chunk_size, overlap, sentence_overlap, strategy })*: The chunking configuration object. +** *`task_settings` (Optional, { custom_attributes, enable_explanations, inference_id, session_id, target_variant })*: Settings to configure the inference task. +These settings are specific to the task type and `service_settings.api` you specified. +** *`timeout` (Optional, string | -1 | 0)*: Specifies the amount of time to wait for the inference endpoint to be created. [discrete] ==== put_anthropic diff --git a/src/api/api/inference.ts b/src/api/api/inference.ts index eac686fa7..798d069b9 100644 --- a/src/api/api/inference.ts +++ b/src/api/api/inference.ts @@ -262,7 +262,7 @@ export default class Inference { } /** - * Create an inference endpoint. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. The following integrations are available through the inference API. You can find the available task types next to the integration name: * AlibabaCloud AI Search (`completion`, `rerank`, `sparse_embedding`, `text_embedding`) * Amazon Bedrock (`completion`, `text_embedding`) * Anthropic (`completion`) * Azure AI Studio (`completion`, `text_embedding`) * Azure OpenAI (`completion`, `text_embedding`) * Cohere (`completion`, `rerank`, `text_embedding`) * DeepSeek (`completion`, `chat_completion`) * Elasticsearch (`rerank`, `sparse_embedding`, `text_embedding` - this service is for built-in models and models uploaded through Eland) * ELSER (`sparse_embedding`) * Google AI Studio (`completion`, `text_embedding`) * Google Vertex AI (`rerank`, `text_embedding`) * Hugging Face (`chat_completion`, `completion`, `rerank`, `text_embedding`) * Mistral (`chat_completion`, `completion`, `text_embedding`) * OpenAI (`chat_completion`, `completion`, `text_embedding`) * VoyageAI (`text_embedding`, `rerank`) * Watsonx inference integration (`text_embedding`) * JinaAI (`text_embedding`, `rerank`) + * Create an inference endpoint. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs. The following integrations are available through the inference API. You can find the available task types next to the integration name: * AlibabaCloud AI Search (`completion`, `rerank`, `sparse_embedding`, `text_embedding`) * Amazon Bedrock (`completion`, `text_embedding`) * Amazon SageMaker (`chat_completion`, `completion`, `rerank`, `sparse_embedding`, `text_embedding`) * Anthropic (`completion`) * Azure AI Studio (`completion`, `text_embedding`) * Azure OpenAI (`completion`, `text_embedding`) * Cohere (`completion`, `rerank`, `text_embedding`) * DeepSeek (`completion`, `chat_completion`) * Elasticsearch (`rerank`, `sparse_embedding`, `text_embedding` - this service is for built-in models and models uploaded through Eland) * ELSER (`sparse_embedding`) * Google AI Studio (`completion`, `text_embedding`) * Google Vertex AI (`rerank`, `text_embedding`) * Hugging Face (`chat_completion`, `completion`, `rerank`, `text_embedding`) * Mistral (`chat_completion`, `completion`, `text_embedding`) * OpenAI (`chat_completion`, `completion`, `text_embedding`) * VoyageAI (`text_embedding`, `rerank`) * Watsonx inference integration (`text_embedding`) * JinaAI (`text_embedding`, `rerank`) * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.19/put-inference-api.html | Elasticsearch API documentation} */ async put (this: That, params: T.InferencePutRequest | TB.InferencePutRequest, options?: TransportRequestOptionsWithOutMeta): Promise @@ -397,22 +397,34 @@ export default class Inference { } /** - * Configure a Amazon SageMaker inference endpoint - * @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.19/infer-service-amazon-sagemaker.html | Elasticsearch API documentation} + * Create an Amazon SageMaker inference endpoint. Create an inference endpoint to perform an inference task with the `amazon_sagemaker` service. + * @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-amazonsagemaker | Elasticsearch API documentation} */ - async putAmazonsagemaker (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise - async putAmazonsagemaker (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise> - async putAmazonsagemaker (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise - async putAmazonsagemaker (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise { + async putAmazonsagemaker (this: That, params: T.InferencePutAmazonsagemakerRequest | TB.InferencePutAmazonsagemakerRequest, options?: TransportRequestOptionsWithOutMeta): Promise + async putAmazonsagemaker (this: That, params: T.InferencePutAmazonsagemakerRequest | TB.InferencePutAmazonsagemakerRequest, options?: TransportRequestOptionsWithMeta): Promise> + async putAmazonsagemaker (this: That, params: T.InferencePutAmazonsagemakerRequest | TB.InferencePutAmazonsagemakerRequest, options?: TransportRequestOptions): Promise + async putAmazonsagemaker (this: That, params: T.InferencePutAmazonsagemakerRequest | TB.InferencePutAmazonsagemakerRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['task_type', 'amazonsagemaker_inference_id'] + const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings', 'task_settings'] const querystring: Record = {} - const body = undefined + // @ts-expect-error + const userBody: any = params?.body + let body: Record | string + if (typeof userBody === 'string') { + body = userBody + } else { + body = userBody != null ? { ...userBody } : undefined + } - params = params ?? {} for (const key in params) { - if (acceptedPath.includes(key)) { + if (acceptedBody.includes(key)) { + body = body ?? {} + // @ts-expect-error + body[key] = params[key] + } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { + // @ts-expect-error querystring[key] = params[key] } } diff --git a/src/api/types.ts b/src/api/types.ts index 1dd850938..608cc74cd 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -13353,6 +13353,31 @@ export interface InferenceAmazonBedrockTaskSettings { export type InferenceAmazonBedrockTaskType = 'completion' | 'text_embedding' +export type InferenceAmazonSageMakerApi = 'openai' | 'elastic' + +export interface InferenceAmazonSageMakerServiceSettings { + access_key: string + endpoint_name: string + api: InferenceAmazonSageMakerApi + region: string + secret_key: string + target_model?: string + target_container_hostname?: string + inference_component_name?: string + batch_size?: integer + dimensions?: integer +} + +export type InferenceAmazonSageMakerServiceType = 'amazon_sagemaker' + +export interface InferenceAmazonSageMakerTaskSettings { + custom_attributes?: string + enable_explanations?: string + inference_id?: string + session_id?: string + target_variant?: string +} + export interface InferenceAnthropicServiceSettings { api_key: string model_id: string @@ -13610,6 +13635,11 @@ export interface InferenceInferenceEndpointInfoAmazonBedrock extends InferenceIn task_type: InferenceTaskTypeAmazonBedrock } +export interface InferenceInferenceEndpointInfoAmazonSageMaker extends InferenceInferenceEndpoint { + inference_id: string + task_type: InferenceTaskTypeAmazonSageMaker +} + export interface InferenceInferenceEndpointInfoAnthropic extends InferenceInferenceEndpoint { inference_id: string task_type: InferenceTaskTypeAnthropic @@ -13802,6 +13832,8 @@ export type InferenceTaskTypeAlibabaCloudAI = 'text_embedding' | 'rerank' | 'com export type InferenceTaskTypeAmazonBedrock = 'text_embedding' | 'completion' +export type InferenceTaskTypeAmazonSageMaker = 'text_embedding' | 'completion' | 'chat_completion' | 'sparse_embedding' | 'rerank' + export type InferenceTaskTypeAnthropic = 'completion' export type InferenceTaskTypeAzureAIStudio = 'text_embedding' | 'completion' @@ -13970,6 +14002,18 @@ export interface InferencePutAmazonbedrockRequest extends RequestBase { export type InferencePutAmazonbedrockResponse = InferenceInferenceEndpointInfoAmazonBedrock +export interface InferencePutAmazonsagemakerRequest extends RequestBase { + task_type: InferenceTaskTypeAmazonSageMaker + amazonsagemaker_inference_id: Id + timeout?: Duration + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAmazonSageMakerServiceType + service_settings: InferenceAmazonSageMakerServiceSettings + task_settings?: InferenceAmazonSageMakerTaskSettings +} + +export type InferencePutAmazonsagemakerResponse = InferenceInferenceEndpointInfoAmazonSageMaker + export interface InferencePutAnthropicRequest extends RequestBase { task_type: InferenceAnthropicTaskType anthropic_inference_id: Id diff --git a/src/api/typesWithBodyKey.ts b/src/api/typesWithBodyKey.ts index 61b70808f..215502165 100644 --- a/src/api/typesWithBodyKey.ts +++ b/src/api/typesWithBodyKey.ts @@ -13595,6 +13595,31 @@ export interface InferenceAmazonBedrockTaskSettings { export type InferenceAmazonBedrockTaskType = 'completion' | 'text_embedding' +export type InferenceAmazonSageMakerApi = 'openai' | 'elastic' + +export interface InferenceAmazonSageMakerServiceSettings { + access_key: string + endpoint_name: string + api: InferenceAmazonSageMakerApi + region: string + secret_key: string + target_model?: string + target_container_hostname?: string + inference_component_name?: string + batch_size?: integer + dimensions?: integer +} + +export type InferenceAmazonSageMakerServiceType = 'amazon_sagemaker' + +export interface InferenceAmazonSageMakerTaskSettings { + custom_attributes?: string + enable_explanations?: string + inference_id?: string + session_id?: string + target_variant?: string +} + export interface InferenceAnthropicServiceSettings { api_key: string model_id: string @@ -13852,6 +13877,11 @@ export interface InferenceInferenceEndpointInfoAmazonBedrock extends InferenceIn task_type: InferenceTaskTypeAmazonBedrock } +export interface InferenceInferenceEndpointInfoAmazonSageMaker extends InferenceInferenceEndpoint { + inference_id: string + task_type: InferenceTaskTypeAmazonSageMaker +} + export interface InferenceInferenceEndpointInfoAnthropic extends InferenceInferenceEndpoint { inference_id: string task_type: InferenceTaskTypeAnthropic @@ -14044,6 +14074,8 @@ export type InferenceTaskTypeAlibabaCloudAI = 'text_embedding' | 'rerank' | 'com export type InferenceTaskTypeAmazonBedrock = 'text_embedding' | 'completion' +export type InferenceTaskTypeAmazonSageMaker = 'text_embedding' | 'completion' | 'chat_completion' | 'sparse_embedding' | 'rerank' + export type InferenceTaskTypeAnthropic = 'completion' export type InferenceTaskTypeAzureAIStudio = 'text_embedding' | 'completion' @@ -14226,6 +14258,21 @@ export interface InferencePutAmazonbedrockRequest extends RequestBase { export type InferencePutAmazonbedrockResponse = InferenceInferenceEndpointInfoAmazonBedrock +export interface InferencePutAmazonsagemakerRequest extends RequestBase { + task_type: InferenceTaskTypeAmazonSageMaker + amazonsagemaker_inference_id: Id + timeout?: Duration + /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ + body?: { + chunking_settings?: InferenceInferenceChunkingSettings + service: InferenceAmazonSageMakerServiceType + service_settings: InferenceAmazonSageMakerServiceSettings + task_settings?: InferenceAmazonSageMakerTaskSettings + } +} + +export type InferencePutAmazonsagemakerResponse = InferenceInferenceEndpointInfoAmazonSageMaker + export interface InferencePutAnthropicRequest extends RequestBase { task_type: InferenceAnthropicTaskType anthropic_inference_id: Id