diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index a0fd2c2d49..9ae2b8cbbe 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -19002,10 +19002,10 @@ "$ref": "#/components/schemas/inference.put_openai:ServiceType" }, "service_settings": { - "$ref": "#/components/schemas/inference.put_openai:OpenAIServiceSettings" + "$ref": "#/components/schemas/inference._types:OpenAIServiceSettings" }, "task_settings": { - "$ref": "#/components/schemas/inference.put_openai:OpenAITaskSettings" + "$ref": "#/components/schemas/inference._types:OpenAITaskSettings" } }, "required": [ @@ -78977,7 +78977,7 @@ "openai" ] }, - "inference.put_openai:OpenAIServiceSettings": { + "inference._types:OpenAIServiceSettings": { "type": "object", "properties": { "api_key": { @@ -79015,7 +79015,7 @@ "model_id" ] }, - "inference.put_openai:OpenAITaskSettings": { + "inference._types:OpenAITaskSettings": { "type": "object", "properties": { "user": { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index b448419298..daf21d4f49 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -10824,10 +10824,10 @@ "$ref": "#/components/schemas/inference.put_openai:ServiceType" }, "service_settings": { - "$ref": "#/components/schemas/inference.put_openai:OpenAIServiceSettings" + "$ref": "#/components/schemas/inference._types:OpenAIServiceSettings" }, "task_settings": { - "$ref": "#/components/schemas/inference.put_openai:OpenAITaskSettings" + "$ref": "#/components/schemas/inference._types:OpenAITaskSettings" } }, "required": [ @@ -50169,7 +50169,7 @@ "openai" ] }, - "inference.put_openai:OpenAIServiceSettings": { + "inference._types:OpenAIServiceSettings": { "type": "object", "properties": { "api_key": { @@ -50207,7 +50207,7 @@ "model_id" ] }, - "inference.put_openai:OpenAITaskSettings": { + "inference._types:OpenAITaskSettings": { "type": "object", "properties": { "user": { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 5d3d82692d..bf691b316e 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -29374,7 +29374,7 @@ "kind": "properties", "properties": [ { - "description": "The chunking configuration object.", + "description": "The chunking configuration object. Only applies for the `text_embedding` task.", "extDocId": "inference-chunking", "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/inference-apis.html#infer-chunking-config", "name": "chunking_settings", @@ -29407,7 +29407,7 @@ "kind": "instance_of", "type": { "name": "OpenAIServiceSettings", - "namespace": "inference.put_openai" + "namespace": "inference._types" } } }, @@ -29419,7 +29419,7 @@ "kind": "instance_of", "type": { "name": "OpenAITaskSettings", - "namespace": "inference.put_openai" + "namespace": "inference._types" } } } @@ -125266,7 +125266,7 @@ "kind": "interface", "name": { "name": "OpenAIServiceSettings", - "namespace": "inference.put_openai" + "namespace": "inference._types" }, "properties": [ { @@ -125347,13 +125347,13 @@ } } ], - "specLocation": "inference/put_openai/PutOpenAiRequest.ts#L94-L136" + "specLocation": "inference/_types/Settings.ts#L23-L65" }, { "kind": "interface", "name": { "name": "OpenAITaskSettings", - "namespace": "inference.put_openai" + "namespace": "inference._types" }, "properties": [ { @@ -125369,7 +125369,7 @@ } } ], - "specLocation": "inference/put_openai/PutOpenAiRequest.ts#L138-L144" + "specLocation": "inference/_types/Settings.ts#L67-L73" }, { "kind": "interface", diff --git a/output/schema/schema.json b/output/schema/schema.json index 366188ab18..ee0a1ddc8c 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -149709,6 +149709,115 @@ ], "specLocation": "inference/_types/Services.ts#L46-L58" }, + { + "kind": "interface", + "name": { + "name": "OpenAIServiceSettings", + "namespace": "inference._types" + }, + "properties": [ + { + "description": "A valid API key of your OpenAI account.\nYou can find your OpenAI API keys in your OpenAI account under the API keys section.\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": "openai-api-keys", + "extDocUrl": "https://platform.openai.com/api-keys", + "name": "api_key", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The number of dimensions the resulting output embeddings should have.\nIt is supported only in `text-embedding-3` and later models.\nIf it is not set, the OpenAI defined default for the model is used.", + "name": "dimensions", + "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 OpenAI documentation for the list of available text embedding models.", + "extDocId": "openai-models", + "extDocUrl": "https://platform.openai.com/docs/guides/embeddings/what-are-embeddings", + "name": "model_id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "The unique identifier for your organization.\nYou can find the Organization ID in your OpenAI account under *Settings > Organizations*.", + "name": "organization_id", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "This setting helps to minimize the number of rate limit errors returned from OpenAI.\nThe `openai` service sets a default number of requests allowed per minute depending on the task type.\nFor `text_embedding`, it is set to `3000`.\nFor `completion`, it is set to `500`.", + "name": "rate_limit", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "RateLimitSetting", + "namespace": "inference._types" + } + } + }, + { + "description": "The URL endpoint to use for the requests.\nIt can be changed for testing purposes.", + "name": "url", + "required": false, + "serverDefault": "https://api.openai.com/v1/embeddings.", + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "inference/_types/Settings.ts#L23-L65" + }, + { + "kind": "interface", + "name": { + "name": "OpenAITaskSettings", + "namespace": "inference._types" + }, + "properties": [ + { + "description": "For a `completion` or `text_embedding` task, specify the user issuing the request.\nThis information can be used for abuse detection.", + "name": "user", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "inference/_types/Settings.ts#L67-L73" + }, { "kind": "interface", "description": "The rerank result object representing a single ranked document\nid: the original index of the document in the request\nrelevance_score: the relevance_score of the document relative to the query\ntext: Optional, the text of the document, if requested", @@ -154699,115 +154808,6 @@ }, "specLocation": "inference/put_mistral/PutMistralRequest.ts#L83-L85" }, - { - "kind": "interface", - "name": { - "name": "OpenAIServiceSettings", - "namespace": "inference.put_openai" - }, - "properties": [ - { - "description": "A valid API key of your OpenAI account.\nYou can find your OpenAI API keys in your OpenAI account under the API keys section.\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": "openai-api-keys", - "extDocUrl": "https://platform.openai.com/api-keys", - "name": "api_key", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "description": "The number of dimensions the resulting output embeddings should have.\nIt is supported only in `text-embedding-3` and later models.\nIf it is not set, the OpenAI defined default for the model is used.", - "name": "dimensions", - "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 OpenAI documentation for the list of available text embedding models.", - "extDocId": "openai-models", - "extDocUrl": "https://platform.openai.com/docs/guides/embeddings/what-are-embeddings", - "name": "model_id", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "description": "The unique identifier for your organization.\nYou can find the Organization ID in your OpenAI account under *Settings > Organizations*.", - "name": "organization_id", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "description": "This setting helps to minimize the number of rate limit errors returned from OpenAI.\nThe `openai` service sets a default number of requests allowed per minute depending on the task type.\nFor `text_embedding`, it is set to `3000`.\nFor `completion`, it is set to `500`.", - "name": "rate_limit", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "RateLimitSetting", - "namespace": "inference._types" - } - } - }, - { - "description": "The URL endpoint to use for the requests.\nIt can be changed for testing purposes.", - "name": "url", - "required": false, - "serverDefault": "https://api.openai.com/v1/embeddings.", - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - } - ], - "specLocation": "inference/put_openai/PutOpenAiRequest.ts#L94-L136" - }, - { - "kind": "interface", - "name": { - "name": "OpenAITaskSettings", - "namespace": "inference.put_openai" - }, - "properties": [ - { - "description": "For a `completion` or `text_embedding` task, specify the user issuing the request.\nThis information can be used for abuse detection.", - "name": "user", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - } - ], - "specLocation": "inference/put_openai/PutOpenAiRequest.ts#L138-L144" - }, { "kind": "enum", "members": [ @@ -154836,7 +154836,7 @@ "kind": "properties", "properties": [ { - "description": "The chunking configuration object.", + "description": "The chunking configuration object. Only applies for the `text_embedding` task.", "extDocId": "inference-chunking", "extDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/inference-apis.html#infer-chunking-config", "name": "chunking_settings", @@ -154869,7 +154869,7 @@ "kind": "instance_of", "type": { "name": "OpenAIServiceSettings", - "namespace": "inference.put_openai" + "namespace": "inference._types" } } }, @@ -154881,7 +154881,7 @@ "kind": "instance_of", "type": { "name": "OpenAITaskSettings", - "namespace": "inference.put_openai" + "namespace": "inference._types" } } } diff --git a/output/typescript/types.ts b/output/typescript/types.ts index dd121bf460..7740185ca8 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -13099,6 +13099,19 @@ export interface InferenceInferenceEndpointInfo extends InferenceInferenceEndpoi task_type: InferenceTaskType } +export interface InferenceOpenAIServiceSettings { + api_key: string + dimensions?: integer + model_id: string + organization_id?: string + rate_limit?: InferenceRateLimitSetting + url?: string +} + +export interface InferenceOpenAITaskSettings { + user?: string +} + export interface InferenceRankedDocument { index: integer relevance_score: float @@ -13662,19 +13675,6 @@ export type InferencePutMistralResponse = InferenceInferenceEndpointInfo export type InferencePutMistralServiceType = 'mistral' -export interface InferencePutOpenaiOpenAIServiceSettings { - api_key: string - dimensions?: integer - model_id: string - organization_id?: string - rate_limit?: InferenceRateLimitSetting - url?: string -} - -export interface InferencePutOpenaiOpenAITaskSettings { - user?: string -} - export type InferencePutOpenaiOpenAITaskType = 'chat_completion' | 'completion' | 'text_embedding' export interface InferencePutOpenaiRequest extends RequestBase { @@ -13683,8 +13683,8 @@ export interface InferencePutOpenaiRequest extends RequestBase { body?: { chunking_settings?: InferenceInferenceChunkingSettings service: InferencePutOpenaiServiceType - service_settings: InferencePutOpenaiOpenAIServiceSettings - task_settings?: InferencePutOpenaiOpenAITaskSettings + service_settings: InferenceOpenAIServiceSettings + task_settings?: InferenceOpenAITaskSettings } } diff --git a/specification/inference/_types/Settings.ts b/specification/inference/_types/Settings.ts new file mode 100644 index 0000000000..aa6a0bac6a --- /dev/null +++ b/specification/inference/_types/Settings.ts @@ -0,0 +1,73 @@ +/* + * 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 { integer } from '@_types/Numeric' + +export class OpenAIServiceSettings { + /** + * A valid API key of your OpenAI account. + * You can find your OpenAI API keys in your OpenAI account under the API keys section. + * + * 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 openai-api-keys + */ + api_key: string + /** + * The number of dimensions the resulting output embeddings should have. + * It is supported only in `text-embedding-3` and later models. + * If it is not set, the OpenAI defined default for the model is used. + */ + dimensions?: integer + /** + * The name of the model to use for the inference task. + * Refer to the OpenAI documentation for the list of available text embedding models. + * @ext_doc_id openai-models + */ + model_id: string + /** + * The unique identifier for your organization. + * You can find the Organization ID in your OpenAI account under *Settings > Organizations*. + */ + organization_id?: string + /** + * This setting helps to minimize the number of rate limit errors returned from OpenAI. + * The `openai` service sets a default number of requests allowed per minute depending on the task type. + * For `text_embedding`, it is set to `3000`. + * For `completion`, it is set to `500`. + */ + rate_limit?: RateLimitSetting + /** + * The URL endpoint to use for the requests. + * It can be changed for testing purposes. + * @server_default https://api.openai.com/v1/embeddings. + */ + url?: string +} + +export class OpenAITaskSettings { + /** + * For a `completion` or `text_embedding` task, specify the user issuing the request. + * This information can be used for abuse detection. + */ + user?: string +} diff --git a/specification/inference/put_openai/PutOpenAiRequest.ts b/specification/inference/put_openai/PutOpenAiRequest.ts index 3453d0cff3..6fdac6c5ad 100644 --- a/specification/inference/put_openai/PutOpenAiRequest.ts +++ b/specification/inference/put_openai/PutOpenAiRequest.ts @@ -17,13 +17,13 @@ * under the License. */ +import { InferenceChunkingSettings } from '@inference/_types/Services' import { - InferenceChunkingSettings, - RateLimitSetting -} from '@inference/_types/Services' + OpenAIServiceSettings, + OpenAITaskSettings +} from '@inference/_types/Settings' import { RequestBase } from '@_types/Base' import { Id } from '@_types/common' -import { integer } from '@_types/Numeric' /** * Create an OpenAI inference endpoint. @@ -61,7 +61,7 @@ export interface Request extends RequestBase { } body: { /** - * The chunking configuration object. + * The chunking configuration object. Only applies for the `text_embedding` task. * @ext_doc_id inference-chunking */ chunking_settings?: InferenceChunkingSettings @@ -90,55 +90,3 @@ export enum OpenAITaskType { export enum ServiceType { openai } - -export class OpenAIServiceSettings { - /** - * A valid API key of your OpenAI account. - * You can find your OpenAI API keys in your OpenAI account under the API keys section. - * - * 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 openai-api-keys - */ - api_key: string - /** - * The number of dimensions the resulting output embeddings should have. - * It is supported only in `text-embedding-3` and later models. - * If it is not set, the OpenAI defined default for the model is used. - */ - dimensions?: integer - /** - * The name of the model to use for the inference task. - * Refer to the OpenAI documentation for the list of available text embedding models. - * @ext_doc_id openai-models - */ - model_id: string - /** - * The unique identifier for your organization. - * You can find the Organization ID in your OpenAI account under *Settings > Organizations*. - */ - organization_id?: string - /** - * This setting helps to minimize the number of rate limit errors returned from OpenAI. - * The `openai` service sets a default number of requests allowed per minute depending on the task type. - * For `text_embedding`, it is set to `3000`. - * For `completion`, it is set to `500`. - */ - rate_limit?: RateLimitSetting - /** - * The URL endpoint to use for the requests. - * It can be changed for testing purposes. - * @server_default https://api.openai.com/v1/embeddings. - */ - url?: string -} - -export class OpenAITaskSettings { - /** - * For a `completion` or `text_embedding` task, specify the user issuing the request. - * This information can be used for abuse detection. - */ - user?: string -}