Skip to content

Commit

Permalink
Improve error handling and update documentation
Browse files Browse the repository at this point in the history
Updated the error message in `OpenAIEmbeddingGenerator.cs` to provide a more specific message for unknown errors. Enhanced the `Readme.md` to include support for the `IEmbeddingGenerator` interface from `Microsoft.Extensions.AI`, and added this change to the changelog under version 8.10.0.
  • Loading branch information
kayhantolga committed Nov 13, 2024
1 parent 72704d5 commit d7f43f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion OpenAI.SDK/Managers/OpenAIEmbeddingGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async Task<GeneratedEmbeddings<Embedding<float>>> IEmbeddingGenerator<string, Em
{
throw new InvalidOperationException(response.Error is { } error ?
$"{response.Error.Code}: {response.Error.Message}" :
"Unknown error");
"Betalgo.Ranul Unknown error");
}

return new(response.Data.Select(e => new Embedding<float>(e.Embedding.Select(d => (float)d).ToArray()) { ModelId = response.Model }))
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Needless to say, I cannot accept responsibility for any damage caused by using t

## Changelog
### 8.10.0
- Added support for `Microsoft.Extensions.AI` IChatClient (more information will be coming soon to the Wiki).
- Added support for `Microsoft.Extensions.AI` `IChatClient` and `IEmbeddingGenerator` (more information will be coming soon to the Wiki).
- Added missing `Temperature` and `TopP` parameters to `AssistantResponse`.
- Added missing `Store` parameter to `ChatCompletionCreateRequest`.

Expand Down

0 comments on commit d7f43f9

Please sign in to comment.