Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.9.0 #668

Merged
merged 6 commits into from
Nov 11, 2024
Merged

8.9.0 #668

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions OpenAI.Playground/OpenAI.Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,27 @@

<ItemGroup>
<PackageReference Include="LaserCatEyes.HttpClientListener" Version="8.0.1" />
<PackageReference Include="NAudio" Version="2.2.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net8.0' And '$(TargetFramework)' != 'net7.0'">
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
Expand Down Expand Up @@ -77,6 +81,9 @@
<None Update="SampleData\FineTuningJobSample2.jsonl">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SampleData\Hello.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SampleData\How-Assistants-work.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -98,6 +105,9 @@
<None Update="SampleData\SentimentAnalysisSample.jsonl">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SampleData\Tell_Me_Story.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
22 changes: 18 additions & 4 deletions OpenAI.Playground/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
using Betalgo.Ranul.OpenAI.Extensions;
using Betalgo.Ranul.OpenAI;
using Betalgo.Ranul.OpenAI.Extensions;
using Betalgo.Ranul.OpenAI.Interfaces;
using Betalgo.Ranul.OpenAI.Managers;
using LaserCatEyes.HttpClientListener;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OpenAI.Playground.TestHelpers;
using OpenAI.Playground.TestHelpers.RealtimeHelpers;

using Microsoft.Extensions.Logging.Console;

var builder = new ConfigurationBuilder().AddJsonFile("ApiSettings.json").AddUserSecrets<Program>();

Expand All @@ -18,6 +25,7 @@

//if you want to use beta services you have to set UseBeta to true. Otherwise, it will use the stable version of OpenAI apis.
serviceCollection.AddOpenAIService(r => r.UseBeta = true);
serviceCollection.AddOpenAIRealtimeService();

//serviceCollection.AddOpenAIService();
//// DeploymentId and ResourceName are only for Azure OpenAI. If you want to use Azure OpenAI services you have to set Provider type To Azure.
Expand All @@ -29,8 +37,12 @@
// options.ResourceName = "MyResourceName";
//});

var serviceProvider = serviceCollection.BuildServiceProvider();
var serviceProvider = serviceCollection.AddLogging((loggingBuilder) => loggingBuilder
.SetMinimumLevel(LogLevel.Debug)
.AddConsole()
).BuildServiceProvider();
var sdk = serviceProvider.GetRequiredService<IOpenAIService>();
var realtimeSdk = serviceProvider.GetRequiredService<IOpenAIRealtimeService>();

// CHAT GPT
// |-----------------------------------------------------------------------|
Expand All @@ -39,8 +51,10 @@
// | / \ / \ | \ /) | ( \ /o\ / ) | (\ / | / \ / \ |
// |-----------------------------------------------------------------------|

await ChatCompletionTestHelper.RunSimpleChatCompletionTest(sdk);
await ChatCompletionTestHelper.RunSimpleCompletionStreamTest(sdk);
//await ChatCompletionTestHelper.RunSimpleChatCompletionTest(sdk);
//await ChatCompletionTestHelper.RunSimpleCompletionStreamTest(sdk);

await (new RealtimeAudioExample(realtimeSdk)).Run();

//Assistants - BETA
//await AssistantTestHelper.BasicsTestHelper.RunTests(sdk);
Expand Down
Binary file added OpenAI.Playground/SampleData/Hello.wav
Binary file not shown.
Binary file added OpenAI.Playground/SampleData/Tell_Me_Story.wav
Binary file not shown.
Loading
Loading