Skip to content

Commit

Permalink
Merge pull request #535 from betalgo/dev
Browse files Browse the repository at this point in the history
8.2.0-beta Assistant
  • Loading branch information
kayhantolga authored Apr 20, 2024
2 parents ace166a + 0dcda0d commit 9473565
Show file tree
Hide file tree
Showing 80 changed files with 2,773 additions and 129 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace OpenAI.Playground;
namespace OpenAI.Playground.ExtensionsAndHelpers;

public static class ConsoleExtensions
{
public static void WriteLine(string value, ConsoleColor color)
public static void WriteLine(string? value, ConsoleColor color = ConsoleColor.Gray)
{
var defaultColor = Console.ForegroundColor;
Console.ForegroundColor = color;
Expand Down
16 changes: 16 additions & 0 deletions OpenAI.Playground/ExtensionsAndHelpers/StringExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Text.Json;

namespace OpenAI.Playground.ExtensionsAndHelpers;

public static class StringExtension
{
public static string? ToJson(this object? s)
{
return s == null ? null : JsonSerializer.Serialize(s);
}

public static T? D<T>(this string json) where T : class
{
return string.IsNullOrWhiteSpace(json) ? null : JsonSerializer.Deserialize<T>(json);
}
}
6 changes: 6 additions & 0 deletions OpenAI.Playground/OpenAI.Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
<None Update="ApiSettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SampleData\betterway_corp.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SampleData\betterway_corp.jsonl">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SampleData\BatchDataSampleFile.jsonl">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
20 changes: 18 additions & 2 deletions OpenAI.Playground/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
// It is in Beta version, if you don't want to use it just comment out below line.
serviceCollection.AddLaserCatEyesHttpClientListener();

//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.AddOpenAIService();
//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.
//serviceCollection.AddOpenAIService(options =>
//{
Expand All @@ -39,9 +41,22 @@
// | / \ / \ | \ /) | ( \ /o\ / ) | (\ / | / \ / \ |
// |-----------------------------------------------------------------------|

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


//Assistants - BETA
//await AssistantTestHelper.RunAssistantApiTest(sdk);
//await AssistantTestHelper.RunHowAssistantsWorkTest(sdk);

//await MessageTestHelper.RunMessageCreateTest(sdk);

//await ThreadTestHelper.RunThreadCreateTest(sdk);
//await ThreadTestHelper.RunThreadRetrieveTest(sdk);

//await RunTestHelper.RunRunCreateTest(sdk);
//await RunTestHelper.RunRunCancelTest(sdk);

// Vision
//await VisionTestHelper.RunSimpleVisionTest(sdk);
//await VisionTestHelper.RunSimpleVisionStreamTest(sdk);
Expand All @@ -51,6 +66,7 @@
//await ChatCompletionTestHelper.RunChatFunctionCallTest(sdk);
//await ChatCompletionTestHelper.RunChatFunctionCallTestAsStream(sdk);
await BatchTestHelper.RunBatchOperationsTest(sdk);

// Whisper
//await AudioTestHelper.RunSimpleAudioCreateTranscriptionTest(sdk);
//await AudioTestHelper.RunSimpleAudioCreateTranslationTest(sdk);
Expand Down
2 changes: 2 additions & 0 deletions OpenAI.Playground/SampleData/betterway_corp.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Company Overview,Company Address
"Please refer to Betterway Supply Chain Co., Ltd. for details.","Betterway Supply Chain Co., Ltd. is located in Jiangsu Province, Nanjing City, Xianlin District, No. 615 on the Eighth Street. Established in 2011, it is a company specializing in the provision of innovative supply chain services, covering the whole country and overseas, mainly in finance, insurance, telecommunications, technology, health, education, agriculture, tourism, automotive, new materials, Australia, Brazil, etc."
1 change: 1 addition & 0 deletions OpenAI.Playground/SampleData/betterway_corp.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"messages":[{"role":"system","content":"You are a professional assistant providing logistics supply chain services"}, {"role":"user","content":"Where exactly is Zhejiang Jiacheng Supply Chain Co., Ltd. located?"}, {"role":"assistant","content":"Zhejiang Jiacheng Supply Chain Co., Ltd. is located at No. 615, Bayi North Street, Wucheng District, Jinhua City, Zhejiang Province, Jiacheng International Business Center"}, {"role":"user","content":"Please introduce Zhejiang Jiacheng Supply Chain Company."}, {"role":"assistant","content":"Zhejiang Jiacheng Supply Chain Company was founded in 2011 and is an innovative supply chain service enterprise focusing on cross-border logistics. Its subsidiaries are located throughout the country and overseas, mainly involving Jinhua, Yiwu, Ningbo, Shenyang, Tianjin, Qingdao, Jinan, Suzhou, Chengdu, Singapore, Germany, Russia and other places."}]}
Loading

0 comments on commit 9473565

Please sign in to comment.