Skip to content

Commit 3057a2f

Browse files
committed
Update readme and deps
1 parent e0de00a commit 3057a2f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

OpenAI_API/OpenAI_API.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.1" />
5151
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
5252
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
53-
<PackageReference Include="Microsoft.Extensions.Http" Version="1.1.1" />
53+
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.0" />
5454
</ItemGroup>
5555

5656
</Project>

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Console.WriteLine(result);
1818
* [Installation](#install-from-nuget)
1919
* [Authentication](#authentication)
2020
* [ChatGPT API](#chatgpt)
21+
* [Conversations](#chat-conversations)
22+
* [Chat Endpoint](#chat-endpoint-requests)
2123
* [Completions API](#completions)
2224
* [Streaming completion results](#streaming)
2325
* [Embeddings API](#embeddings)
@@ -35,7 +37,7 @@ Added support for ChatGPT, DALLE 2 image generations, and the moderation endpoin
3537

3638
Now also should work with the Azure OpenAI Service, although this is untested. See the [Azure](#azure) section for further details.
3739

38-
Thank you [@GotMike](https://github.com/gotmike), [@megalon](https://github.com/megalon), [@stonelv](https://github.com/stonelv), [@ncface](https://github.com/ncface), [@KeithHenry](https://github.com/KeithHenry), [@gmilano](https://github.com/gmilano), [@metjuperry](https://github.com/metjuperry), [@pandapknaepel](https://github.com/pandapknaepel), and [@Alexei000](https://github.com/Alexei000) for your contributions!
40+
Thank you [@babrekel](https://github.com/babrekel), [@JasonWei512](https://github.com/JasonWei512), [@GotMike](https://github.com/gotmike), [@megalon](https://github.com/megalon), [@stonelv](https://github.com/stonelv), [@ncface](https://github.com/ncface), [@KeithHenry](https://github.com/KeithHenry), [@gmilano](https://github.com/gmilano), [@metjuperry](https://github.com/metjuperry), [@pandapknaepel](https://github.com/pandapknaepel), and [@Alexei000](https://github.com/Alexei000) for your contributions!
3941

4042
## Requirements
4143

@@ -126,22 +128,22 @@ chat.AppendUserInput("How to make a hamburger?");
126128

127129
await foreach (var res in chat.StreamResponseEnumerableFromChatbotAsync())
128130
{
129-
Console.Write(res);
131+
Console.Write(res);
130132
}
131133
```
132134

133-
Or if using classic .NET framework or C# <8.0:
135+
Or if using classic .NET Framework or C# <8.0:
134136
```csharp
135137
var chat = api.Chat.CreateConversation();
136138
chat.AppendUserInput("How to make a hamburger?");
137139

138140
await chat.StreamResponseFromChatbotAsync(res =>
139141
{
140-
Console.Write(res);
142+
Console.Write(res);
141143
});
142144
```
143145

144-
#### Chat Endpoint Requests
146+
### Chat Endpoint Requests
145147
You can access full control of the Chat API by using the `OpenAIAPI.Chat.CreateChatCompletionAsync()` and related methods.
146148

147149
```csharp
@@ -302,6 +304,14 @@ OpenAIAPI api = OpenAIAPI.ForAzure("YourResourceName", "deploymentId", "api-key"
302304

303305
You may then use the `api` object like normal. You may also specify the `APIAuthentication` is any of the other ways listed in the [Authentication](#authentication) section above. Currently this library only supports the api-key flow, not the AD-Flow.
304306

307+
## IHttpClientFactory
308+
While this library does not fully support dependancy injection at this time, you may specify an `IHttpClientFactory` to be used for HTTP requests, which allows for tweaking http request properties, connection pooling, and mocking. Details in [#103](https://github.com/OkGoDoIt/OpenAI-API-dotnet/pull/103).
309+
310+
```csharp
311+
OpenAIAPI api = new OpenAIAPI();
312+
api.HttpClientFactory = myIHttpClientFactoryObject;
313+
```
314+
305315
## Documentation
306316

307317
Every single class, method, and property has extensive XML documentation, so it should show up automatically in IntelliSense. That combined with the official OpenAI documentation should be enough to get started. Feel free to open an issue here if you have any questions. Better documentation may come later.

0 commit comments

Comments
 (0)