Skip to content
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

.Net: Rename AzureChatCompletion to AzureOpenAIChatCompletion (and other types) #3155

Closed
Tracked by #3134
stephentoub opened this issue Oct 11, 2023 · 7 comments · Fixed by #3399
Closed
Tracked by #3134

.Net: Rename AzureChatCompletion to AzureOpenAIChatCompletion (and other types) #3155

stephentoub opened this issue Oct 11, 2023 · 7 comments · Fixed by #3399
Assignees
Labels
sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)
Milestone

Comments

@stephentoub
Copy link
Member

stephentoub commented Oct 11, 2023

Important

Labeled Urgent because it may require a breaking change.

We have OpenAIChatCompletion and AzureChatCompletion, and OpenAIRequestSettings which appears to be what should be used with both. Should AzureChatCompletion (and related types) be renamed to have AzureOpenAI instead of Azure as the prefix? Will AzureChatCompletion work with everything "Azure" in the future and not just the "AzureOpenAI" service? Will someone seeing they need to pass an AIRequestSettings to work with AzureChatCompletion know that it's the OpenAIRequestSettings they need to use even though there's no Azure in the name?

@matthewbolanos matthewbolanos added the sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community) label Oct 11, 2023
@matthewbolanos matthewbolanos changed the title Naming inconsistencies with Azure and OpenAI .Net: Rename AzureChatCompletion to AzureOpenAIChatCompletion Oct 12, 2023
@matthewbolanos matthewbolanos changed the title .Net: Rename AzureChatCompletion to AzureOpenAIChatCompletion .Net: Rename AzureChatCompletion to AzureOpenAIChatCompletion (and other types) Oct 12, 2023
@matthewbolanos
Copy link
Member

matthewbolanos commented Oct 12, 2023

The existing Azure Chat/Text completion connectors should make it clear that they're only for OpenAI models.

@stephentoub
Copy link
Member Author

Looking at this again, why do the AzureOpenAIXx types/methods even need to exist? Isn't everything identical between the AzureOpenAIXx and OpenAIXx types, including implementation down to the OpenAIClient being used. and the only difference is whether an endpoint is supplied to the ctor?

@dmytrostruk
Copy link
Member

why do the AzureOpenAIXx types/methods even need to exist

@stephentoub Even taking into account that for both Azure OpenAI and OpenAI services we use the same Azure .NET SDK, we need to remember that these are separately hosted services with different configuration. Each service has its own deployment model, retry strategy, throttling etc. I think it's good to differentiate them by .NET types, rather than passed settings in constructor. Also, there are things like AzureChatCompletionWithData, which extends Azure OpenAI functionality, while on OpenAI side there are things like "Function Calling" and potential features in the future.

But I 100% agree that Azure* types should be renamed to AzureOpenAI* types for better understanding.

@stephentoub
Copy link
Member Author

But I 100% agree that Azure* types should be renamed to AzureOpenAI* types for better understanding.

👍

while on OpenAI side there are things like "Function Calling"

That exists in Azure OpenAI as well.

@stephentoub
Copy link
Member Author

stephentoub commented Oct 13, 2023

I don't feel super strongly about consolidating them. But having two completely separate type hierarchices, sets of extension methods, etc., is just extra work for anyone trying to be portable across OpenAI and Azure OpenAI, which is unfortunate given that at the end of the day they end up using the exact same OpenAIClient under the covers, share all of the same code to get there, etc. It seems like unnecessary friction. If we really believe there's going to be divergence in the future that would make consolidation problematic, ok... but I'd be curious what we think that'll be given that OpenAIClient is servicing both.

@dmytrostruk
Copy link
Member

Ideally, I would use separate SDKs as these are separate services. But taking into account that we use only one, maybe it makes sense to have one type to handle both services.

On Python side, AzureChatCompletion inherits OpenAIChatCompletion:

class AzureChatCompletion(OpenAIChatCompletion):
_endpoint: str
_api_version: str
_api_type: str

In case we will have just one type to work with Azure OpenAI and OpenAI, we will have to differentiate both services somehow inside that type, for example for logging. It's important to see in logs which service responds and how.

@dmytrostruk dmytrostruk moved this to Sprint: Planned in Semantic Kernel Oct 16, 2023
@SergeyMenshykh
Copy link
Member

We can find a middle ground here: keep the SK public API (WithAzureChatCompletionService, WithOpenAIChatCompletionService) as it is today but consolidate the connectors into one. Later, we can always add another connector in case of divergence without impacting SK consumer code.

@dmytrostruk dmytrostruk moved this from Sprint: Planned to Sprint: In Review in Semantic Kernel Nov 6, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 7, 2023
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

Resolves: #3155

This PR contains changes to rename `Azure*` classes and methods to
`AzureOpenAI*` to make it clear that they work with OpenAI models.

Note: `AzureTextCompletion` class and related extension methods remain
the same, as they are marked as obsolete in this PR:
#3396

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone - this is breaking change, as some public
classes and methods were renamed.

Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this from Sprint: In Review to Sprint: Done in Semantic Kernel Nov 7, 2023
stephentoub pushed a commit to stephentoub/semantic-kernel that referenced this issue Nov 7, 2023
)

### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

Resolves: microsoft#3155

This PR contains changes to rename `Azure*` classes and methods to
`AzureOpenAI*` to make it clear that they work with OpenAI models.

Note: `AzureTextCompletion` class and related extension methods remain
the same, as they are marked as obsolete in this PR:
microsoft#3396

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone - this is breaking change, as some public
classes and methods were renamed.

Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants