.Net: Added dimensions property to OpenAI embedding generation services#6077
Conversation
dotnet/src/Connectors/Connectors.OpenAI/OpenAIServiceCollectionExtensions.cs
Show resolved
Hide resolved
|
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. |
dotnet/src/Connectors/Connectors.OpenAI/OpenAIServiceCollectionExtensions.cs
Show resolved
Hide resolved
@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.
All embedding functionality is marked as |
|
IF this is Experimental, suggest creating a new method marked as |
@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 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. |
…es (microsoft#6077) ### 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#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  ### 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 - [x] I didn't break anyone 😄
Motivation and Context
Resolves: #6026
This PR contains changes to expose

dimensionsproperty which is supported by OpenAI and Azure .NET SDK:https://platform.openai.com/docs/api-reference/embeddings/create#embeddings-create-dimensions
Contribution Checklist