Skip to content

Commit fe23d41

Browse files
.Net: Fix issue #4608 (#4609)
### 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. --> Issue #4608 ### Description In multiple instances in the OpenAIMemoryBuilderExtensions class, the httpClient parameter was unintentionally hidden. To resolve this, discard was used in the function arguments to disable hiding. This change ensures the intended functionality isn't accidentally obstructed and enhances code readability and maintainability. <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 --------- Co-authored-by: SergeyMenshykh <[email protected]>
1 parent 1c07c2f commit fe23d41

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎dotnet/src/Connectors/Connectors.OpenAI/OpenAIMemoryBuilderExtensions.cs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ public static MemoryBuilder WithAzureOpenAITextEmbeddingGeneration(
3333
string? modelId = null,
3434
HttpClient? httpClient = null)
3535
{
36-
return builder.WithTextEmbeddingGeneration((loggerFactory, httpClient) =>
36+
return builder.WithTextEmbeddingGeneration((loggerFactory, builderHttpClient) =>
3737
new AzureOpenAITextEmbeddingGenerationService(
3838
deploymentName,
3939
endpoint,
4040
apiKey,
4141
modelId,
42-
HttpClientProvider.GetHttpClient(httpClient),
42+
HttpClientProvider.GetHttpClient(httpClient ?? builderHttpClient),
4343
loggerFactory));
4444
}
4545

@@ -63,13 +63,13 @@ public static MemoryBuilder WithAzureOpenAITextEmbeddingGeneration(
6363
string? modelId = null,
6464
HttpClient? httpClient = null)
6565
{
66-
return builder.WithTextEmbeddingGeneration((loggerFactory, httpClient) =>
66+
return builder.WithTextEmbeddingGeneration((loggerFactory, builderHttpClient) =>
6767
new AzureOpenAITextEmbeddingGenerationService(
6868
deploymentName,
6969
endpoint,
7070
credential,
7171
modelId,
72-
HttpClientProvider.GetHttpClient(httpClient),
72+
HttpClientProvider.GetHttpClient(httpClient ?? builderHttpClient),
7373
loggerFactory));
7474
}
7575

@@ -91,12 +91,12 @@ public static MemoryBuilder WithOpenAITextEmbeddingGeneration(
9191
string? orgId = null,
9292
HttpClient? httpClient = null)
9393
{
94-
return builder.WithTextEmbeddingGeneration((loggerFactory, httpClient) =>
94+
return builder.WithTextEmbeddingGeneration((loggerFactory, builderHttpClient) =>
9595
new OpenAITextEmbeddingGenerationService(
9696
modelId,
9797
apiKey,
9898
orgId,
99-
HttpClientProvider.GetHttpClient(httpClient),
99+
HttpClientProvider.GetHttpClient(httpClient ?? builderHttpClient),
100100
loggerFactory));
101101
}
102102
}

0 commit comments

Comments
 (0)