|
2 | 2 |
|
3 | 3 | A simple C# .NET wrapper library to use with OpenAI's GPT-3 API. More context [on my blog](https://rogerpincombe.com/openai-dotnet-api).
|
4 | 4 |
|
5 |
| -## Status |
6 |
| -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. |
8 |
| -Now also works with the Azure OpenAI Service. See Azure section for further details. |
9 |
| - |
10 |
| -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! |
11 |
| - |
12 | 5 | ## Quick Example
|
13 | 6 |
|
14 | 7 | ```csharp
|
15 |
| -var api = new OpenAI_API.OpenAIAPI(); |
16 |
| - |
| 8 | +var api = new OpenAI_API.OpenAIAPI("YOUR_API_KEY"); |
17 | 9 | var result = await api.Completions.GetCompletion("One Two Three One Two");
|
18 | 10 | Console.WriteLine(result);
|
19 | 11 | // should print something starting with "Three"
|
20 | 12 | ```
|
21 | 13 |
|
| 14 | +## Readme |
| 15 | + |
| 16 | + * [Status](#Status) |
| 17 | + * [Requirements](#requirements) |
| 18 | + * [Installation](#install-from-nuget) |
| 19 | + * [Authentication](#authentication) |
| 20 | + * [Completions API](#completions) |
| 21 | + * [Streaming completion results](#streaming) |
| 22 | + * [Embeddings API](#embeddings) |
| 23 | + * [Files API](#files-for-fine-tuning) |
| 24 | + * [Additonal Documentation](#documentation) |
| 25 | + * [License](#license) |
| 26 | + |
| 27 | +## Status |
| 28 | +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. |
| 29 | +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 existing code. |
| 30 | + |
| 31 | +Now also works with the Azure OpenAI Service. See [Azure](#azure) section for further details. |
| 32 | + |
| 33 | +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! |
22 | 34 |
|
23 | 35 | ## Requirements
|
24 | 36 |
|
@@ -111,7 +123,7 @@ async Task<EmbeddingResult> CreateEmbeddingAsync(EmbeddingRequest request);
|
111 | 123 | // for example
|
112 | 124 | var result = await api.Embeddings.CreateEmbeddingAsync(new EmbeddingRequest("A test text for embedding", model: Model.AdaTextEmbedding));
|
113 | 125 | // or
|
114 |
| -var result = await api.Completions.CreateCompletionAsync("A test text for embedding"); |
| 126 | +var result = await api.Embeddings.CreateEmbeddingAsync("A test text for embedding"); |
115 | 127 | ```
|
116 | 128 |
|
117 | 129 | The embedding result contains a lot of metadata, the actual vector of floats is in result.Data[].Embedding.
|
@@ -155,7 +167,6 @@ Additionally you need to specify the BaseUrl to your API. The Url should look so
|
155 | 167 | https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}
|
156 | 168 | ```
|
157 | 169 |
|
158 |
| - |
159 | 170 | Configuration should look something like this for the Azure service:
|
160 | 171 |
|
161 | 172 | ```csharp
|
|
0 commit comments