Skip to content

Commit 54fd906

Browse files
committedFeb 3, 2023
Updated readme to clarify namespace changes
1 parent b66b7b6 commit 54fd906

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed
 

‎OpenAI_API/OpenAI_API.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<RepositoryUrl>https://github.com/OkGoDoIt/OpenAI-API-dotnet</RepositoryUrl>
1414
<PackageTags>OpenAI, AI, ML, API</PackageTags>
1515
<Title>OpenAI API</Title>
16-
<PackageReleaseNotes>Updated to work with the current API as of February 2, 2023. Added Files and Embedding endpoints. Removed the Search endpoint as OpenAI has removed that API.</PackageReleaseNotes>
16+
<PackageReleaseNotes>Updated to work with the current API as of February 3, 2023. Added Files and Embedding endpoints. Removed the Search endpoint as OpenAI has removed that API. Potentially breaking change with v1.4: The various endpoints (Completions, Models, etc) and related classes have each moved into their own namespaces, for example `OpenAI_API.Completions.CompletionRequest` and `OpenAI_API.Models.Model.DavinciText`. You may need to add `using`s or fully qualify names in exisitng code.</PackageReleaseNotes>
1717
<PackageId>OpenAI</PackageId>
1818
<Version>1.4.0</Version>
1919
<AssemblyVersion>1.4.0.0</AssemblyVersion>

‎README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ A simple C# .NET wrapper library to use with OpenAI's GPT-3 API. More context [
44

55
## Status
66
Updated to work with the current API as of February 2, 2023. Added Files and Embedding endpoints. Removed the Search endpoint as OpenAI has removed that API.
7+
Potentially breaking change with v1.4: The various endpoints (Completions, Models, etc) and related classes have each moved into their own namespaces, for example `OpenAI_API.Completions.CompletionRequest` and `OpenAI_API.Models.Model.DavinciText`. You may need to add `using`s or fully qualify names in exisitng code.
78

89
Thank you [@GotMike](https://github.com/gotmike), [@gmilano](https://github.com/gmilano), [@metjuperry](https://github.com/metjuperry), and [@Alexei000](https://github.com/Alexei000) for your contributions!
910

@@ -66,7 +67,7 @@ OpenAIAPI api = new OpenAIAPI(new APIAuthentication("YOUR_API_KEY","org-yourOrgH
6667
The Completion API is accessed via `OpenAIAPI.Completions`:
6768

6869
```csharp
69-
async Task<CompletionResult> CreateCompletionAsync(CompletionRequest request)
70+
async Task<CompletionResult> CreateCompletionAsync(CompletionRequest request);
7071

7172
// for example
7273
var result = await api.Completions.CreateCompletionAsync(new CompletionRequest("One Two Three One Two", model: Model.CurieText, temperature: 0.1));
@@ -81,7 +82,7 @@ Streaming allows you to get results are they are generated, which can help your
8182

8283
Using the new C# 8.0 async iterators:
8384
```csharp
84-
IAsyncEnumerable<CompletionResult> StreamCompletionEnumerableAsync(CompletionRequest request)
85+
IAsyncEnumerable<CompletionResult> StreamCompletionEnumerableAsync(CompletionRequest request);
8586

8687
// for example
8788
await foreach (var token in api.Completions.StreamCompletionEnumerableAsync(new CompletionRequest("My name is Roger and I am a principal software engineer at Salesforce. This is my resume:", Model.DavinciText, 200, 0.5, presencePenalty: 0.1, frequencyPenalty: 0.1)))
@@ -92,7 +93,7 @@ await foreach (var token in api.Completions.StreamCompletionEnumerableAsync(new
9293

9394
Or if using classic .NET framework or C# <8.0:
9495
```csharp
95-
async Task StreamCompletionAsync(CompletionRequest request, Action<CompletionResult> resultHandler)
96+
async Task StreamCompletionAsync(CompletionRequest request, Action<CompletionResult> resultHandler);
9697

9798
// for example
9899
await api.Completions.StreamCompletionAsync(
@@ -104,7 +105,7 @@ await api.Completions.StreamCompletionAsync(
104105
The Embedding API is accessed via `OpenAIAPI.Embeddings`:
105106

106107
```csharp
107-
async Task<EmbeddingResult> CreateEmbeddingAsync(EmbeddingRequest request)
108+
async Task<EmbeddingResult> CreateEmbeddingAsync(EmbeddingRequest request);
108109

109110
// for example
110111
var result = await api.Embeddings.CreateEmbeddingAsync(new EmbeddingRequest("A test text for embedding", model: Model.AdaTextEmbedding));
@@ -121,20 +122,20 @@ The Files API endpoint is accessed via `OpenAIAPI.Files`:
121122

122123
```csharp
123124
// uploading
124-
async Task<File> UploadFileAsync(string filePath, string purpose = "fine-tune")
125+
async Task<File> UploadFileAsync(string filePath, string purpose = "fine-tune");
125126

126127
// for example
127128
var response = await api.Files.UploadFileAsync("fine-tuning-data.jsonl");
128129
Console.Write(response.Id); //the id of the uploaded file
129130
130131
// listing
131-
async Task<List<File>> GetFilesAsync()
132+
async Task<List<File>> GetFilesAsync();
132133

133134
// for example
134135
var response = await api.Files.GetFilesAsync();
135136
foreach (var file in response)
136137
{
137-
Console.WriteLine(file.Name)
138+
Console.WriteLine(file.Name);
138139
}
139140
```
140141

0 commit comments

Comments
 (0)
Please sign in to comment.