Skip to content

Commit f3b6a4b

Browse files
committed
Misc. fixes
1 parent cfc86aa commit f3b6a4b

17 files changed

+43
-42
lines changed

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is used to automatically assign reviewers to PRs.
2+
# For more information, see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
3+
4+
# The '*' pattern represents global owners.
5+
* @joseharriaga @trrwilson @ShivangiReja

CHANGELOG.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,22 @@
44

55
### Features added
66

7-
- `ChatCompletionOptions` now has an `StoredOutputEnabled` property (reflecting [the REST `store` property](https://platform.openai.com/docs/api-reference/chat/create#chat-create-store)) as well as a `Metadata` property ([`metadata` in REST](https://platform.openai.com/docs/api-reference/chat/create#chat-create-metadata))
8-
- `ChatTokenUsage` (`Usage` on `ChatCompletion`) has been expanded:
9-
- A new `InputTokenDetails` property (of new type `ChatInputTokenUsageDetails`) has been added, containing breakdowns of `AudioTokenCount` and `CachedTokenCount` for usage with supported models
10-
- The existing `OutputTokenDetails` has been expanded to include `AudioTokenCount` for supported models
11-
- `ModerationResult` now includes `Illicit` and `IllictViolent` categories
12-
- `ModerationCategory` now includes a (bitmasked flag enum) `ApplicableInputKinds` property, representing applied input types for the category
13-
14-
**Realtime**
15-
16-
***Note**: the `/realtime` area is under rapid development and not all changes may be reflected here.*
17-
18-
- `ConversationRateLimitsUpdate` (previously `ConversationRateLimitsUpdatedUpdate`) now includes named `RequestDetails` and `TokenDetails` properties, mapping to the corresponding named items in the underlying `rate_limits` command payload
19-
- Several types have been renamed for consistency and clarity
20-
21-
## 2.0.1 (Unreleased)
7+
- Added a `StoredOutputEnabled` property to `ChatCompletionOptions` ([`store` in the REST API](https://platform.openai.com/docs/api-reference/chat/create#chat-create-store)). (commit_hash)
8+
- Use this property to indicate whether or not to store the output of the chat completion for use in model distillation or evals.
9+
- Added a `Metadata` property to `ChatCompletionOptions` ([`metadata` in the REST API](https://platform.openai.com/docs/api-reference/chat/create#chat-create-metadata)). (commit_hash)
10+
- Use this property to add custom tags and values to the chat completions for filtering in the OpenAI dashboard.
11+
- Added an `InputTokenDetails` property to `ChatTokenUsage` ([`usage.prompt_token_details` in the REST API](https://platform.openai.com/docs/api-reference/chat/object#chat/object-usage)). (commit_hash)
12+
- The property is of a new type called `ChatInputTokenUsageDetails`, which contains properties for `AudioTokenCount` and `CachedTokenCount` for usage with supported models.
13+
- Added an `AudioTokenCount` property to `ChatOutputTokenUsageDetails` ([`usage.completion_token_details` in the REST API](https://platform.openai.com/docs/api-reference/chat/object#chat/object-usage)). Audio support in chat completions is coming soon. (commit_hash)
14+
- Added `Illicit` and `IllictViolent` properties `ModerationResult` to represent these two new moderation categories. (commit_hash)
15+
- Made improvements to the experimental Realtime API. Please note this features area is currently under rapid development and not all changes may be reflected here. (commit_hash)
16+
- Several types have been renamed for consistency and clarity.
17+
- `ConversationRateLimitsUpdate` (previously `ConversationRateLimitsUpdatedUpdate`) now includes named `RequestDetails` and `TokenDetails` properties, mapping to the corresponding named items in the underlying `rate_limits` command payload.
2218

2319
### Other Changes
2420

25-
- Updated the referenced version of `System.ClientModel` to the latest `1.21.0`
26-
- This transitively updates an inherited `System.Text.Json` dependency from `6.0.9` to `6.0.10`, resolving security compliance with [CVE-2024-43485](https://github.com/advisories/GHSA-8g4q-xg66-9fp4). Please note that the described vulnerability was not directly applicable to this library as `[ExtensionData]` is not used.
21+
- Updated the `System.ClientModel` dependency to version `1.21.0`. (commit_hash)
22+
- This updates the `System.Text.Json` transitive dependency to version `6.0.10`, which includes a security compliance fix for [CVE-2024-43485](https://github.com/advisories/GHSA-8g4q-xg66-9fp4). Please note that the OpenAI library was not impacted by this vulnerability since it does not use the `[JsonExtensionData]` feature.
2723

2824
## 2.1.0-beta.1 (2024-10-01)
2925

File renamed without changes.
File renamed without changes.

examples/Assistants/Example01_RetrievalAugmentedGeneration.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ public partial class AssistantExamples
1414
public void Example01_RetrievalAugmentedGeneration()
1515
{
1616
// Assistants is a beta API and subject to change; acknowledge its experimental status by suppressing the matching warning.
17-
#pragma warning disable OPENAI001
17+
#pragma warning disable OPENAI001
1818
OpenAIClient openAIClient = new(Environment.GetEnvironmentVariable("OPENAI_API_KEY"));
1919
OpenAIFileClient fileClient = openAIClient.GetOpenAIFileClient();
2020
AssistantClient assistantClient = openAIClient.GetAssistantClient();
2121

2222
// First, let's contrive a document we'll use retrieval with and upload it.
23-
using Stream document = BinaryData.FromString("""
23+
using Stream document = BinaryData.FromBytes("""
2424
{
2525
"description": "This document contains the sale history data for Contoso products.",
2626
"sales": [
@@ -47,7 +47,7 @@ public void Example01_RetrievalAugmentedGeneration()
4747
}
4848
]
4949
}
50-
""").ToStream();
50+
"""u8.ToArray()).ToStream();
5151

5252
OpenAIFile salesFile = fileClient.UploadFile(
5353
document,

examples/Assistants/Example01_RetrievalAugmentedGenerationAsync.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ public partial class AssistantExamples
1515
public async Task Example01_RetrievalAugmentedGenerationAsync()
1616
{
1717
// Assistants is a beta API and subject to change; acknowledge its experimental status by suppressing the matching warning.
18-
#pragma warning disable OPENAI001
18+
#pragma warning disable OPENAI001
1919
OpenAIClient openAIClient = new(Environment.GetEnvironmentVariable("OPENAI_API_KEY"));
2020
OpenAIFileClient fileClient = openAIClient.GetOpenAIFileClient();
2121
AssistantClient assistantClient = openAIClient.GetAssistantClient();
2222

2323
// First, let's contrive a document we'll use retrieval with and upload it.
24-
using Stream document = BinaryData.FromString("""
24+
using Stream document = BinaryData.FromBytes("""
2525
{
2626
"description": "This document contains the sale history data for Contoso products.",
2727
"sales": [
@@ -48,7 +48,7 @@ public async Task Example01_RetrievalAugmentedGenerationAsync()
4848
}
4949
]
5050
}
51-
""").ToStream();
51+
"""u8.ToArray()).ToStream();
5252

5353
OpenAIFile salesFile = await fileClient.UploadFileAsync(
5454
document,

examples/Assistants/Example05_AssistantsWithVision.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ public partial class AssistantExamples
1313
public void Example05_AssistantsWithVision()
1414
{
1515
// Assistants is a beta API and subject to change; acknowledge its experimental status by suppressing the matching warning.
16-
#pragma warning disable OPENAI001
16+
#pragma warning disable OPENAI001
1717
OpenAIClient openAIClient = new(Environment.GetEnvironmentVariable("OPENAI_API_KEY"));
1818
OpenAIFileClient fileClient = openAIClient.GetOpenAIFileClient();
1919
AssistantClient assistantClient = openAIClient.GetAssistantClient();
2020

2121
OpenAIFile pictureOfAppleFile = fileClient.UploadFile(
22-
Path.Combine("Assets", "picture-of-apple.png"),
22+
Path.Combine("Assets", "images_apple.png"),
2323
FileUploadPurpose.Vision);
24-
Uri linkToPictureOfOrange = new("https://raw.githubusercontent.com/openai/openai-dotnet/refs/heads/main/examples/Assets/picture-of-orange.png");
24+
25+
Uri linkToPictureOfOrange = new("https://raw.githubusercontent.com/openai/openai-dotnet/refs/heads/main/examples/Assets/images_orange.png");
2526

2627
Assistant assistant = assistantClient.CreateAssistant(
2728
"gpt-4o",

examples/Assistants/Example05_AssistantsWithVisionAsync.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ public partial class AssistantExamples
1414
public async Task Example05_AssistantsWithVisionAsync()
1515
{
1616
// Assistants is a beta API and subject to change; acknowledge its experimental status by suppressing the matching warning.
17-
#pragma warning disable OPENAI001
17+
#pragma warning disable OPENAI001
1818
OpenAIClient openAIClient = new(Environment.GetEnvironmentVariable("OPENAI_API_KEY"));
1919
OpenAIFileClient fileClient = openAIClient.GetOpenAIFileClient();
2020
AssistantClient assistantClient = openAIClient.GetAssistantClient();
2121

2222
OpenAIFile pictureOfAppleFile = await fileClient.UploadFileAsync(
23-
Path.Combine("Assets", "picture-of-apple.png"),
23+
Path.Combine("Assets", "images_apple.png"),
2424
FileUploadPurpose.Vision);
25-
Uri linkToPictureOfOrange = new("https://raw.githubusercontent.com/openai/openai-dotnet/refs/heads/main/examples/Assets/picture-of-orange.png");
25+
26+
Uri linkToPictureOfOrange = new("https://raw.githubusercontent.com/openai/openai-dotnet/refs/heads/main/examples/Assets/images_orange.png");
2627

2728
Assistant assistant = await assistantClient.CreateAssistantAsync(
2829
"gpt-4o",

examples/Chat/Example02_SimpleChatStreaming.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public void Example02_SimpleChatStreaming()
1212
{
1313
ChatClient client = new(model: "gpt-4o", apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY"));
1414

15-
CollectionResult<StreamingChatCompletionUpdate> completionUpdates
16-
= client.CompleteChatStreaming("Say 'this is a test.'");
15+
CollectionResult<StreamingChatCompletionUpdate> completionUpdates = client.CompleteChatStreaming("Say 'this is a test.'");
1716

1817
Console.Write($"[ASSISTANT]: ");
1918
foreach (StreamingChatCompletionUpdate completionUpdate in completionUpdates)

0 commit comments

Comments
 (0)