Преглед изворни кода

[Inference API] Add Azure OpenAI completion docs (#108704)

Tim Grein пре 1 година
родитељ
комит
34293131b8

+ 1 - 1
docs/reference/inference/delete-inference.asciidoc

@@ -7,7 +7,7 @@ experimental[]
 Deletes an {infer} endpoint.
 
 IMPORTANT: The {infer} APIs enable you to use certain services, such as built-in
-{ml} models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, or
+{ml} models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure or
 Hugging Face. For built-in models and models uploaded though Eland, the {infer}
 APIs offer an alternative way to use and manage trained models. However, if you
 do not plan to use the {infer} APIs to use these models or if you want to use

+ 1 - 1
docs/reference/inference/get-inference.asciidoc

@@ -7,7 +7,7 @@ experimental[]
 Retrieves {infer} endpoint information.
 
 IMPORTANT: The {infer} APIs enable you to use certain services, such as built-in
-{ml} models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, or
+{ml} models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure or
 Hugging Face. For built-in models and models uploaded though Eland, the {infer}
 APIs offer an alternative way to use and manage trained models. However, if you
 do not plan to use the {infer} APIs to use these models or if you want to use

+ 2 - 2
docs/reference/inference/inference-apis.asciidoc

@@ -5,7 +5,7 @@
 experimental[]
 
 IMPORTANT: The {infer} APIs enable you to use certain services, such as built-in
-{ml} models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, or
+{ml} models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure or
 Hugging Face. For built-in models and models uploaded though Eland, the {infer}
 APIs offer an alternative way to use and manage trained models. However, if you
 do not plan to use the {infer} APIs to use these models or if you want to use
@@ -24,4 +24,4 @@ the following APIs to manage {infer} models and perform {infer}:
 include::delete-inference.asciidoc[]
 include::get-inference.asciidoc[]
 include::post-inference.asciidoc[]
-include::put-inference.asciidoc[]
+include::put-inference.asciidoc[]

+ 3 - 3
docs/reference/inference/post-inference.asciidoc

@@ -7,7 +7,7 @@ experimental[]
 Performs an inference task on an input text by using an {infer} endpoint.
 
 IMPORTANT: The {infer} APIs enable you to use certain services, such as built-in
-{ml} models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, or
+{ml} models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure or
 Hugging Face. For built-in models and models uploaded though Eland, the {infer}
 APIs offer an alternative way to use and manage trained models. However, if you
 do not plan to use the {infer} APIs to use these models or if you want to use
@@ -133,8 +133,8 @@ The following example performs reranking on the example input.
 ------------------------------------------------------------
 POST _inference/rerank/cohere_rerank
 {
-  "input": ["luke", "like", "leia", "chewy","r2d2", "star", "wars"], 
-  "query": "star wars main character" 
+  "input": ["luke", "like", "leia", "chewy","r2d2", "star", "wars"],
+  "query": "star wars main character"
 }
 ------------------------------------------------------------
 // TEST[skip:TBD]

+ 24 - 1
docs/reference/inference/put-inference.asciidoc

@@ -79,7 +79,7 @@ Cohere service.
 service.
 * `openai`: specify the `completion` or `text_embedding` task type to use the
 OpenAI service.
-* `azureopenai`: specify the `text_embedding` task type to use the Azure OpenAI service.
+* `azureopenai`: specify the `completion` or `text_embedding` task type to use the Azure OpenAI service.
 * `elasticsearch`: specify the `text_embedding` task type to use the E5
 built-in model or text embedding models uploaded by Eland.
 
@@ -552,3 +552,26 @@ PUT _inference/text_embedding/azure_openai_embeddings
 }
 ------------------------------------------------------------
 // TEST[skip:TBD]
+
+The next example shows how to create an {infer} endpoint called
+`azure_openai_completion` to perform a `completion` task type.
+
+[source,console]
+------------------------------------------------------------
+PUT _inference/completion/azure_openai_completion
+{
+    "service": "azureopenai",
+    "service_settings": {
+        "api_key": "<api_key>",
+        "resource_name": "<resource_name>",
+        "deployment_id": "<deployment_id>",
+        "api_version": "2024-02-01"
+    }
+}
+------------------------------------------------------------
+// TEST[skip:TBD]
+
+The list of chat completion models that you can choose from in your Azure OpenAI deployment can be found at the following places:
+
+* https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-4-and-gpt-4-turbo-models[GPT-4 and GPT-4 Turbo models]
+* https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-35[GPT-3.5]