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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Added dimensions property to OpenAI embedding generation services #6077

Merged

Conversation

dmytrostruk
Copy link
Member

Motivation and Context

Resolves: #6026

This PR contains changes to expose dimensions property which is supported by OpenAI and Azure .NET SDK:
https://platform.openai.com/docs/api-reference/embeddings/create#embeddings-create-dimensions
image

Contribution Checklist

@dmytrostruk dmytrostruk self-assigned this May 1, 2024
@dmytrostruk dmytrostruk requested a review from a team as a code owner May 1, 2024 01:46
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels May 1, 2024
@RogerBarreto
Copy link
Member

Adding this parameter at the connector level seems to be an issue, we might consider having a ExecutionSettings for embeddings API...

Any change on this matter I would add as experimental if the plan is to soon move this to be a setting per Invocation.

@westey-m

@dmytrostruk
Copy link
Member Author

Adding this parameter at the connector level seems to be an issue, we might consider having a ExecutionSettings for embeddings API...

@RogerBarreto I thought about that, but I also think that we can have both options supported. If you set vector dimensions once on connector level, you won't have to do that with each request. And I don't think that this parameter will change too much in runtime, because every time you change the dimension, your data may lose a context.

ExecutionSettings for embedding API will be supported, here is ADR for this:
#5277

Any change on this matter I would add as experimental if the plan is to soon move this to be a setting per Invocation.

All embedding functionality is marked as Experimental at the moment.

@RogerBarreto
Copy link
Member

RogerBarreto commented May 1, 2024

IF this is Experimental, suggest creating a new method marked as Experimental with the new dimension extra parameter to avoid the breaking change.

@dmytrostruk
Copy link
Member Author

IF this is Experimental, suggest creating a new method marked as Experimental with the new dimension extra parameter to avoid the breaking change.

@RogerBarreto I thought about that as well :) But the thing is that there are 11 methods that were modified. In order to avoid breaking changes, I will need to add 11 more overload methods with new parameter. It's not a big problem, but since we agreed that at some point we will have to obsolete existing methods and replace them with Config classes, I'm not sure if we need to add new methods now in order to obsolete them later.

Besides, this is breaking change only from API compatibility point of view, but not for compiler, that's the reason I added this parameter as last one. And since these are static methods, it's not possible to mock them in tests, so it should not break mocking scenarios.

@dmytrostruk dmytrostruk added this pull request to the merge queue May 2, 2024
Merged via the queue into microsoft:main with commit b4bfef1 May 2, 2024
15 checks passed
@dmytrostruk dmytrostruk deleted the openai-text-embedding-dimensions branch May 2, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.Net: Support for embedding dimensions
5 participants