Skip to content

Commit

Permalink
Prepare 2.0.0 release (Part 1) (#233)
Browse files Browse the repository at this point in the history
- Implemented `ChatMessageContent` to encapsulate the representation of content parts in `ChatMessage`, `ChatCompletion`, and `StreamingChatCompletionUpdate`.
- Changed the representation of function arguments to `BinaryData` in `ChatToolCall`, `StreamingChatToolCallUpdate`, `ChatFunctionCall`, and `StreamingChatFunctionCallUpdate`. 
- Renamed `OpenAIClientOptions`'s `ApplicationId` to `UserAgentApplicationId` (commit_hash)
- Renamed `StreamingChatToolCallUpdate`'s `Id` to `ToolCallId`
- Renamed `StreamingChatCompletionUpdate`'s `Id` to `CompletionId`
- Replaced `Auto` and `None` in the deprecated `ChatFunctionChoice` with `CreateAutoChoice()` and `CreateNoneChoice()` 
- Replaced the deprecated `ChatFunctionChoice(ChatFunction)` constructor with `CreateNamedChoice(string functionName)` 
- Renamed `FileClient` to `OpenAIFileClient` and the corresponding `GetFileClient()` method in `OpenAIClient` to `GetOpenAIFileClient()`. 
- Renamed `ModelClient` to `OpenAIModelClient` and the corresponding `GetModelClient()` method in `OpenAIClient` to `GetOpenAIModelClient()`.
  • Loading branch information
joseharriaga authored Sep 30, 2024
1 parent eb0e82f commit 31c2ba6
Show file tree
Hide file tree
Showing 125 changed files with 1,478 additions and 1,106 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Release History

## 2.0.0-beta.14 (Unreleased)

### Breaking Changes

- Implemented `ChatMessageContent` to encapsulate the representation of content parts in `ChatMessage`, `ChatCompletion`, and `StreamingChatCompletionUpdate`. (commit_hash)
- Changed the representation of function arguments to `BinaryData` in `ChatToolCall`, `StreamingChatToolCallUpdate`, `ChatFunctionCall`, and `StreamingChatFunctionCallUpdate`. (commit_hash)
- Renamed `OpenAIClientOptions`'s `ApplicationId` to `UserAgentApplicationId` (commit_hash)
- Renamed `StreamingChatToolCallUpdate`'s `Id` to `ToolCallId` (commit_hash)
- Renamed `StreamingChatCompletionUpdate`'s `Id` to `CompletionId` (commit_hash)
- Replaced `Auto` and `None` in the deprecated `ChatFunctionChoice` with `CreateAutoChoice()` and `CreateNoneChoice()` (commit_hash)
- Replaced the deprecated `ChatFunctionChoice(ChatFunction)` constructor with `CreateNamedChoice(string functionName)` (commit_hash)
- Renamed `FileClient` to `OpenAIFileClient` and the corresponding `GetFileClient()` method in `OpenAIClient` to `GetOpenAIFileClient()`. (commit_hash)
- Renamed `ModelClient` to `OpenAIModelClient` and the corresponding `GetModelClient()` method in `OpenAIClient` to `GetOpenAIModelClient()`. (commit_hash)

## 2.0.0-beta.13 (2024-09-27)

### Breaking Changes
Expand Down
4 changes: 2 additions & 2 deletions MigrationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Old library's endpoint|New library's client
|Translations | AudioClient
|Moderation | ModerationClient
|Embeddings | EmbeddingClient
|Files | FileClient
|Models | ModelClient
|Files | OpenAIFileClient
|Models | OpenAIModelClient
|Completions | Not supported

## Authentication
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ The library is organized into several namespaces corresponding to OpenAI feature
| `OpenAI.Chat` | `ChatClient` | |
| `OpenAI.Embeddings` | `EmbeddingClient` | |
| `OpenAI.FineTuning` | `FineTuningClient` | ![Experimental](https://img.shields.io/badge/experimental-purple) |
| `OpenAI.Files` | `FileClient` | |
| `OpenAI.Files` | `OpenAIFileClient` | |
| `OpenAI.Images` | `ImageClient` | |
| `OpenAI.Models` | `ModelClient` | |
| `OpenAI.Models` | `OpenAIModelClient` | |
| `OpenAI.Moderations` | `ModerationClient` | |
| `OpenAI.VectorStores` | `VectorStoreClient` | ![Experimental](https://img.shields.io/badge/experimental-purple) |

Expand Down Expand Up @@ -466,7 +466,7 @@ foreach (TranscribedSegment segment in transcription.Segments)

In this example, you have a JSON document with the monthly sales information of different products, and you want to build an assistant capable of analyzing it and answering questions about it.

To achieve this, use both `FileClient` from the `OpenAI.Files` namespace and `AssistantClient` from the `OpenAI.Assistants` namespace.
To achieve this, use both `OpenAIFileClient` from the `OpenAI.Files` namespace and `AssistantClient` from the `OpenAI.Assistants` namespace.

Important: The Assistants REST API is currently in beta. As such, the details are subject to change, and correspondingly the `AssistantClient` is attributed as `[Experimental]`. To use it, suppress the `OPENAI001` warning at either the project level or, as below, in the code itself.

Expand All @@ -477,7 +477,7 @@ using OpenAI.Files;
// Assistants is a beta API and subject to change; acknowledge its experimental status by suppressing the matching warning.
#pragma warning disable OPENAI001
OpenAIClient openAIClient = new(Environment.GetEnvironmentVariable("OPENAI_API_KEY"));
FileClient fileClient = openAIClient.GetFileClient();
OpenAIFileClient fileClient = openAIClient.GetOpenAIFileClient();
AssistantClient assistantClient = openAIClient.GetAssistantClient();
```

Expand Down Expand Up @@ -514,7 +514,7 @@ using Stream document = BinaryData.FromString("""
""").ToStream();
```

Upload this document to OpenAI using the `FileClient`'s `UploadFile` method, ensuring that you use `FileUploadPurpose.Assistants` to allow your assistant to access it later:
Upload this document to OpenAI using the `OpenAIFileClient`'s `UploadFile` method, ensuring that you use `FileUploadPurpose.Assistants` to allow your assistant to access it later:

```csharp
OpenAIFile salesFile = fileClient.UploadFile(
Expand Down Expand Up @@ -654,13 +654,13 @@ The graph above visualizes this trend, showing a peak in sales during February.

This example shows how to use the v2 Assistants API to provide image data to an assistant and then stream the run's response.

As before, you will use a `FileClient` and an `AssistantClient`:
As before, you will use a `OpenAIFileClient` and an `AssistantClient`:

```csharp
// Assistants is a beta API and subject to change; acknowledge its experimental status by suppressing the matching warning.
#pragma warning disable OPENAI001
OpenAIClient openAIClient = new(Environment.GetEnvironmentVariable("OPENAI_API_KEY"));
FileClient fileClient = openAIClient.GetFileClient();
OpenAIFileClient fileClient = openAIClient.GetOpenAIFileClient();
AssistantClient assistantClient = openAIClient.GetAssistantClient();
```

Expand Down
Loading

0 comments on commit 31c2ba6

Please sign in to comment.