-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Inference API] Fix Azure AI Studio Integration for Completions and Embeddings #119818
base: main
Are you sure you want to change the base?
Conversation
…ngs, tests are broken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, good stuff! 👏 Gave it a first pass and left some comments, already looking good
...xpack/inference/external/request/azureaistudio/AzureAiStudioChatCompletionRequestEntity.java
Outdated
Show resolved
Hide resolved
...rch/xpack/inference/external/request/azureaistudio/AzureAiStudioEmbeddingsRequestEntity.java
Outdated
Show resolved
Hide resolved
...a/org/elasticsearch/xpack/inference/external/request/azureaistudio/AzureAiStudioRequest.java
Outdated
Show resolved
Hide resolved
...h/xpack/inference/external/response/azureaistudio/AzureAiStudioEmbeddingsResponseEntity.java
Outdated
Show resolved
Hide resolved
...elasticsearch/xpack/inference/external/request/azureaistudio/AzureAiStudioRequestFields.java
Outdated
Show resolved
Hide resolved
...a/org/elasticsearch/xpack/inference/services/azureaistudio/AzureAiStudioServiceSettings.java
Outdated
Show resolved
Hide resolved
.../inference/external/request/azureaistudio/AzureAiStudioChatCompletionRequestEntityTests.java
Outdated
Show resolved
Hide resolved
.../inference/external/request/azureaistudio/AzureAiStudioChatCompletionRequestEntityTests.java
Outdated
Show resolved
Hide resolved
...pack/inference/external/request/azureaistudio/AzureAiStudioEmbeddingsRequestEntityTests.java
Outdated
Show resolved
Hide resolved
...arch/xpack/inference/external/request/azureaistudio/AzureAiStudioEmbeddingsRequestTests.java
Outdated
Show resolved
Hide resolved
Note: I'm waiting to complete the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly left comments around changes we need to address with regards to the transport level changes - we can also sync on that, it can be a bit confusing in the beginning
...in/java/org/elasticsearch/xpack/inference/external/request/azureopenai/AzureOpenAiUtils.java
Show resolved
Hide resolved
...ack/inference/external/response/azureaistudio/AzureAiStudioChatCompletionResponseEntity.java
Outdated
Show resolved
Hide resolved
...a/org/elasticsearch/xpack/inference/services/azureaistudio/AzureAiStudioServiceSettings.java
Outdated
Show resolved
Hide resolved
...a/org/elasticsearch/xpack/inference/services/azureaistudio/AzureAiStudioServiceSettings.java
Outdated
Show resolved
Hide resolved
...a/org/elasticsearch/xpack/inference/services/azureaistudio/AzureAiStudioServiceSettings.java
Outdated
Show resolved
Hide resolved
...a/org/elasticsearch/xpack/inference/services/azureaistudio/AzureAiStudioServiceSettings.java
Outdated
Show resolved
Hide resolved
out.writeEnum(provider); | ||
out.writeEnum(endpointType); | ||
if (out.getTransportVersion().before(AZURE_AI_FOUNDRY_INTEGRATION_FIX_1_10_25)) { | ||
out.writeEnum(AzureAiFoundryProvider.NONE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old node will does not know about the enum value AzureAiFoundryProvider.NONE
as that is added in this PR. Enums are written by their ordinal values, the old node will read the ordinal value for AzureAiFoundryProvider.NONE
(let's say it is 2) but then throw an error because it does not know of any AzureAiFoundryProvider
enum with ordinal value 2.
If there isn't a logical mapping from the old fields (provider, endpointtype) to the new (deploymenttype, model) then it is a question of how we want this to fail.
Inference endpoint creation is a master node action. The request will be serialised from whichever node it lands on to the master node and the response in turn will be serialised back to the originating node. PutInferenceModelAction.Response
contains the ServiceSettings
(we return the new endpoint configuration), if the originating node is an old node that doesn't know about the new options it won't return the proper config as some fields have been lost in serialisation. We can solve for that by not allowing new AzureAiFoundry inference endpoints to be created in a mixed cluster where some nodes do not know about this change.
) | ||
); | ||
|
||
namedWriteables.add( | ||
new NamedWriteableRegistry.Entry( | ||
ServiceSettings.class, | ||
AzureAiStudioChatCompletionServiceSettings.NAME, | ||
AzureAiStudioChatCompletionServiceSettings::new | ||
AzureAiFoundryChatCompletionServiceSettings.NAME, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAME has changed from azure_ai_studio_chat_completion_service_settings
to azure_ai_foundry_chat_completion_service_settings
. When an old node writes a named writable with the old name azure_ai_studio_chat_completion_service_settings
this node will not know about it.
Because there is logic in the AzureAiFoundryChatCompletionServiceSettings
serialisation code to handle backwards compatibility it is better not to change the name. Just add a comment explaining that NAME
hasn't changed to maintain BWC
This draft PR fixes the Inference API integration with Azure AI Foundry (previously Azure AI Studio). The previous integration was broken for both completions and embeddings models due to API changes from Microsoft.
Core Changes:
AzureAiStudioDeploymentType
to the service settingsazure_ai_model_inference_service
orserverless_api
Once testing is complete, I will add more detailed docs describing the deployment types, their configurations, and describe how to use this integration with screenshots from the Azure console.
Local Testing:
Embeddings:
Completions:
Related Issues:
Helpful Links: