From c7e230e353b2b8d5481ceac4a3b0bf9927ed388a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Tue, 10 Dec 2024 11:37:33 +0100 Subject: [PATCH 1/4] [DOCS] Documents dimensions param for openai service of Inference API. --- docs/reference/inference/service-openai.asciidoc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/reference/inference/service-openai.asciidoc b/docs/reference/inference/service-openai.asciidoc index 21643133553e1..d199a64ff986b 100644 --- a/docs/reference/inference/service-openai.asciidoc +++ b/docs/reference/inference/service-openai.asciidoc @@ -76,6 +76,11 @@ https://platform.openai.com/api-keys[API keys section]. include::inference-shared.asciidoc[tag=api-key-admonition] -- +`dimensions`::: +(Optional, integer) +The number of dimensions the resulting output embeddings should have. +Only supported in `text-embedding-3` and later models. + `model_id`::: (Required, string) The name of the model to use for the {infer} task. @@ -134,8 +139,7 @@ Specifies the user issuing the request, which can be used for abuse detection. [[inference-example-openai]] ==== OpenAI service example -The following example shows how to create an {infer} endpoint called -`openai-embeddings` to perform a `text_embedding` task type. +The following example shows how to create an {infer} endpoint called `openai-embeddings` to perform a `text_embedding` task type. [source,console] ------------------------------------------------------------ @@ -144,14 +148,14 @@ PUT _inference/text_embedding/openai-embeddings "service": "openai", "service_settings": { "api_key": "", - "model_id": "text-embedding-ada-002" + "model_id": "text-embedding-3-small", + "dimensions": 128 } } ------------------------------------------------------------ // TEST[skip:TBD] -The next example shows how to create an {infer} endpoint called -`openai-completion` to perform a `completion` task type. +The next example shows how to create an {infer} endpoint called `openai-completion` to perform a `completion` task type. [source,console] ------------------------------------------------------------ From 7a9e50e28155128d2e987e3beb900c1b20cdecab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Tue, 10 Dec 2024 11:51:47 +0100 Subject: [PATCH 2/4] Update docs/reference/inference/service-openai.asciidoc Co-authored-by: David Kyle --- docs/reference/inference/service-openai.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/inference/service-openai.asciidoc b/docs/reference/inference/service-openai.asciidoc index d199a64ff986b..e7985bd97b848 100644 --- a/docs/reference/inference/service-openai.asciidoc +++ b/docs/reference/inference/service-openai.asciidoc @@ -139,7 +139,7 @@ Specifies the user issuing the request, which can be used for abuse detection. [[inference-example-openai]] ==== OpenAI service example -The following example shows how to create an {infer} endpoint called `openai-embeddings` to perform a `text_embedding` task type. +The following example shows how to create an {infer} endpoint called `openai-embeddings` to perform a `text_embedding` task type. The embeddings created by requests to this endpoint will have 128 dimensions. [source,console] ------------------------------------------------------------ From 2ce5d2d2af211e9722e5351344159165ad39c598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Tue, 10 Dec 2024 11:51:54 +0100 Subject: [PATCH 3/4] Update docs/reference/inference/service-openai.asciidoc Co-authored-by: David Kyle --- docs/reference/inference/service-openai.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/inference/service-openai.asciidoc b/docs/reference/inference/service-openai.asciidoc index e7985bd97b848..eb2b86c1db584 100644 --- a/docs/reference/inference/service-openai.asciidoc +++ b/docs/reference/inference/service-openai.asciidoc @@ -80,7 +80,7 @@ include::inference-shared.asciidoc[tag=api-key-admonition] (Optional, integer) The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models. - +If not set the OpenAI defined default for the model is used `model_id`::: (Required, string) The name of the model to use for the {infer} task. From a96ede9e78e05955acc7ce6a08127331e9568934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Tue, 10 Dec 2024 11:53:05 +0100 Subject: [PATCH 4/4] [DOCS] Further edits. --- docs/reference/inference/service-openai.asciidoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/reference/inference/service-openai.asciidoc b/docs/reference/inference/service-openai.asciidoc index eb2b86c1db584..9211e2d08e88b 100644 --- a/docs/reference/inference/service-openai.asciidoc +++ b/docs/reference/inference/service-openai.asciidoc @@ -80,7 +80,8 @@ include::inference-shared.asciidoc[tag=api-key-admonition] (Optional, integer) The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models. -If not set the OpenAI defined default for the model is used +If not set the OpenAI defined default for the model is used. + `model_id`::: (Required, string) The name of the model to use for the {infer} task. @@ -139,7 +140,8 @@ Specifies the user issuing the request, which can be used for abuse detection. [[inference-example-openai]] ==== OpenAI service example -The following example shows how to create an {infer} endpoint called `openai-embeddings` to perform a `text_embedding` task type. The embeddings created by requests to this endpoint will have 128 dimensions. +The following example shows how to create an {infer} endpoint called `openai-embeddings` to perform a `text_embedding` task type. +The embeddings created by requests to this endpoint will have 128 dimensions. [source,console] ------------------------------------------------------------