Skip to content

Commit fc8667d

Browse files
authored
Merge branch 'master' into develop
2 parents 83aa25b + 97fb71b commit fc8667d

File tree

2 files changed

+37
-19
lines changed

2 files changed

+37
-19
lines changed

OpenAI_API/OpenAI_API.csproj

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,35 @@
1515
<Title>OpenAI API</Title>
1616
<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>
18-
<Version>1.4.0</Version>
19-
<AssemblyVersion>1.4.0.0</AssemblyVersion>
20-
<FileVersion>1.4.0.0</FileVersion>
18+
<Version>1.4.1</Version>
19+
<AssemblyVersion>1.4.1.0</AssemblyVersion>
20+
<FileVersion>1.4.1.0</FileVersion>
2121
<GenerateDocumentationFile>True</GenerateDocumentationFile>
2222
<PackageReadmeFile>README.md</PackageReadmeFile>
2323
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
2424
<RepositoryType>git</RepositoryType>
25-
<IncludeSymbols>True</IncludeSymbols>
25+
26+
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
27+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
28+
<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
29+
<IncludeSymbols>true</IncludeSymbols>
2630
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
31+
2732
<Deterministic>true</Deterministic>
33+
2834
</PropertyGroup>
2935

3036
<ItemGroup>
31-
<None Include="..\README.md">
32-
<Pack>True</Pack>
33-
<PackagePath>\</PackagePath>
34-
</None>
37+
<None Include="..\README.md">
38+
<Pack>True</Pack>
39+
<PackagePath>\</PackagePath>
40+
</None>
3541
</ItemGroup>
3642

3743
<ItemGroup>
3844
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.1" />
3945
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
46+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
4047
</ItemGroup>
4148

4249
</Project>

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,35 @@
22

33
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).
44

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-
125
## Quick Example
136

147
```csharp
15-
var api = new OpenAI_API.OpenAIAPI();
16-
8+
var api = new OpenAI_API.OpenAIAPI("YOUR_API_KEY");
179
var result = await api.Completions.GetCompletion("One Two Three One Two");
1810
Console.WriteLine(result);
1911
// should print something starting with "Three"
2012
```
2113

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!
2234

2335
## Requirements
2436

@@ -111,7 +123,7 @@ async Task<EmbeddingResult> CreateEmbeddingAsync(EmbeddingRequest request);
111123
// for example
112124
var result = await api.Embeddings.CreateEmbeddingAsync(new EmbeddingRequest("A test text for embedding", model: Model.AdaTextEmbedding));
113125
// 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");
115127
```
116128

117129
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
155167
https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}
156168
```
157169

158-
159170
Configuration should look something like this for the Azure service:
160171

161172
```csharp

0 commit comments

Comments
 (0)