-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ADR: OpenAI + AzureOpenAI Connector #6664
ADR: OpenAI + AzureOpenAI Connector #6664
Conversation
As the whole underpinnings here are changing, I suggest we do accept breaking changes here, and that we:
We should also put in place a changelog that includes notable changes from release to release, including notes on breaking changes and what specifically someone should do to address the change. I obviously don't take breaking changes lightly, but this is one of those times when it's warranted. |
it could be an opportunity to handle more functionality in these clients , like cost estimation logprobs and feedback , good luck on this one, it's not a trival thing to update and it also affect environment variables , so it's a big deal actually . |
I tend on the opinion of @stephentoub here. more things will be added to the API And also what @Josephrp states too. Two APIs that evolve separately (even they will converge eventually) and have their own SDKs. Option 2 then is best IMHO. |
If there's room for it, it would be nice to rename top_p/TopP to "nucleus sampling" |
@dluc As top_p is something provider specific I would keep the name that the provider uses, and only use a Nucleus Sampling name if the API does that. Our On the subject of Different APIs refering as
|
OpenAI and Azure Connectors Naming and Structuring
Resolves #6529
Context and Problem Statement
It has recently been announced that OpenAI and Azure will each have their own dedicated SDKs for accessing their services. Previously, there was no official SDK for OpenAI, and our OpenAI Connector relied solely on the Azure SDK client for access.
With the introduction of the official OpenAI SDK, we now have access to more up-to-date features provided by OpenAI, making it advantageous to use this SDK instead of the Azure SDK.
Additionally, it has become clear that we need to separate the OpenAI connector into two distinct targets: one for OpenAI and another for Azure OpenAI. This separation will enhance code clarity and facilitate a better understanding of the usage of each target.
Decision Drivers
Versioning
Although current
Azure.AI.OpenAI
andOpenAI
SDKs have being update on its major versions, that change does not represents aSemanticKernel
major breaking change, any options below consider that he new updated version ofSemanticKernel.Connectors.OpenAI
will be a minor version bump1.N+1.0
.Meta Package Strategy
Currently the
Microsoft.SemanticKernel
package is a meta package that includes bothSemanticKernel.Core
andSemanticKernel.Connectors.OpenAI
, with the new changes a new project will be added to the meta packageSemanticKernel.Connectors.AzureOpenAI
that will include the new Azure OpenAI connector.Documentation (Upgrade Path)
A documentation guidance and samples/examples will be created to guide on how to upgrade from the current OpenAI connector to the new when needed.
OpenAI SDK limitations
The new OpenAI SDK introduce some limitations that need to be considered and pontentially can introduce breaking changes if not remediated by our internal implementation.
Remediation: Internally make the multiple requests and combine them.
No remediation: Breaking change removing
ResultsPerPrompt
fromOpenAIPromptExecutionSettings
.Remediation: Internally provide a HttpClient to be used against
gpt-3.5-turbo-instruct
for text generation modality. Same way was done forTextToImage
,AudioToText
service modalities.No remediation: Breaking change removing any specific
TextGeneration
service implementations, this change don't impactChatCompletion
services that may still being used asITextGenerationService
implementations.Improvements
This also represents an opportunity to improve the current OpenAI connector by introducing the
Configuration
pattern to allow more flexibility and control over the services and their configurations.Considered Options
Option 1 - Slow Transition
This is the least breaking approach where we keep the current legacy OpenAI and AzureOpenAI APIs temporarily in the connector using last Azure SDK
Azure.AI.OpenAI 1.0.0-beta.17
and add new OpenAI specific APIs using the newOpenAI 2.0.0-beta.*
SDK package.This approach also implies that a new connector will be created on a second moment for Azure OpenAI services specifically fully dependent on the latest
Azure.AI.OpenAI 2.0.0-beta.*
SDK package.In a later stage we will deprecate all the OpenAI and Azure legacy APIs in the
SemanticKernel.Connectors.OpenAI
namespace and remove Azure SDKAzure.AI.OpenAI 1.0.0-beta.17
and those APIs in a future release, making the OpenAI Connector fully dedicated for OpenAI services only depending on with theOpenAI 2.0.0-beta.*
dependency.The new
Options
pattern we be used as an improvement as well as a measure to avoid breaking changes with the legacy APIs.Following this change the the
SemanticKernel.Connectors.OpenAI
a new connector will be createdSemanticKernel.Connectors.AzureOpenAI
for Azure OpenAI services, using the Azure SDKAzure.AI.OpenAI 2.0.0-beta.*
with all new APIs using the options approach.Phases of the transition
OpenAI
connector pointing to newAzureOpenAI
connectorAzureOpenAI
connector to theMicrosoft.SemanticKernel
meta package.OpenAI APIs
in theOpenAI
connector pointing to newOptions
APIs.Impact
Pros:
Cons:
SemanticKernel.Connectors.AzureOpenAI
andSemanticKernel.Connectors.OpenAI
share a same dependency of different versions, both packages cannot be used in the same project and a strategy will be needed when deploying both connectors:Azure OpenAI 1.0-beta17
andOpenAI 2.0-beta1
.Dependency Management Strategies
Concepts
and other projects that shares OpenAI and AzureOpenAI examples.Azure.AI.OpenAI.Legacy 1.0.0-beta.17
and update ourSemanticKernel.Connectors.OpenAI
to use this new namespace to avoid version clashing on theAzure.AI.OpenAI
namespace.Option 2 - Independent Connectors from Start.
This option is focused on creating fully independent connectors for OpenAI and Azure OpenAI services since the start with all breaking changes needed to achieve that.
Impact:
Azure
extension methods will be removed fromSemanticKernel.Connectors.OpenAI
namespace to avoid clashing with same names introduced in the newSemanticKernel.Connectors.AzureOpenAI
.All azure specific services like
AzureOpenAIChatCompletion
,AzureOpenAITextGeneration
services will be obsoleted and throw not supported exceptions when used fromSemanticKernel.Connectors.OpenAI
connector.Impact
Pros:
Cons:
Option 3 - Update OpenAI with Azure as is.
This option is fully focused in the least impact possible, combining both Azure and OpenAI SDK dependencies in one single connector following the same approach as the current connector.
Changes:
Options
pattern new APIs to the connector services and deprecate old ones.Impact
Pros:
Cons:
Azure.AI.OpenAI
package, which may not be the latest version available.Decision Outcome
Chosen option:
TBD
OpenAI SDK limitations: