Skip to content

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
rstropek committed Sep 9, 2024
1 parent 30f5e1b commit ab826da
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
1 change: 1 addition & 0 deletions labs/035-assistants-dotnet/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.Data.SqlClient;
using OpenAI.Assistants;
using OpenAI.Chat;
#pragma warning disable OPENAI001

namespace AssistantsDotNet;

Expand Down
12 changes: 7 additions & 5 deletions labs/035-assistants-dotnet/OpenAIExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ static class OpenAIExtensions
{
public static async Task<Assistant?> FindAssistantByName(this AssistantClient client, string name)
{
await foreach (var assistant in client.GetAssistantsAsync())
await foreach (var assistants in client.GetAssistantsAsync())
{
if (assistant.Name == name) { return assistant; }
foreach (var assistant in assistants.Values) {
if (assistant.Name == name) { return assistant; }
}
}

return null;
Expand Down Expand Up @@ -41,7 +43,7 @@ public static async Task<Assistant> CreateOrUpdate(this AssistantClient client,
public static async IAsyncEnumerable<string> AddMessageAndRunToCompletion(this AssistantClient client, string threadId, string assistantId,
string message, Func<RequiredActionUpdate, Task<object>>? functionCallback = null)
{
await client.CreateMessageAsync(threadId, [message]);
await client.CreateMessageAsync(threadId, MessageRole.User, [message]);
var asyncUpdate = client.CreateRunStreamingAsync(threadId, assistantId);

ThreadRun? currentRun;
Expand Down Expand Up @@ -98,9 +100,9 @@ public static async IAsyncEnumerable<string> AddMessageAndRunToCompletion(this A

public static async Task<string?> GetLatestMessage(this AssistantClient client, string threadId)
{
await foreach(var msg in client.GetMessagesAsync(threadId, ListOrder.NewestFirst))
await foreach(var msgs in client.GetMessagesAsync(threadId, new MessageCollectionOptions() { Order = ListOrder.NewestFirst }))
{
return msg.Content[0].Text;
return msgs.Values[0]?.Content[0].Text;
}

return null;
Expand Down
6 changes: 3 additions & 3 deletions labs/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Dapper" Version="2.1.35" />
<PackageVersion Include="dotenv.net" Version="3.1.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.3" />
<PackageVersion Include="OpenAI" Version="2.0.0-beta.4" />
<PackageVersion Include="dotenv.net" Version="3.2.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageVersion Include="OpenAI" Version="2.0.0-beta.11" />
</ItemGroup>
</Project>
38 changes: 19 additions & 19 deletions labs/HandsOnLabs.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "010-basics", "010-basics", "{663030A0-0A93-4565-BEE2-2F356E49FEFA}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "010-basics-dotnet", "010-basics-dotnet", "{ECF40993-4AD0-441E-93E7-F80E62465259}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiBasicsDotNet", "010-basics-dotnet\ApiBasicsDotNet\ApiBasicsDotNet.csproj", "{99F0BCCA-ED5E-4654-937F-C79E7E2130C4}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiBasicsDotNet", "010-basics-dotnet\ApiBasicsDotNet\ApiBasicsDotNet.csproj", "{6569C5F1-0230-43E5-9041-1CD4C214F748}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "020-functions", "020-functions", "{468B4675-71B9-4397-8225-4DDEC46DD4B0}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "020-functions-dotnet", "020-functions-dotnet", "{FFD3A9CA-B05C-4519-921C-2ECFFC523D74}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunctionCallingDotNet", "020-functions-dotnet\FunctionCallingDotNet\FunctionCallingDotNet.csproj", "{A71026F5-ACF4-49FF-94C4-73006234E737}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunctionCallingDotNet", "020-functions-dotnet\FunctionCallingDotNet\FunctionCallingDotNet.csproj", "{BF6F92A4-E8B9-4DCB-A851-3E67CEAC4DDC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "035-assistants-dotnet", "035-assistants-dotnet\035-assistants-dotnet.csproj", "{4410FBFF-81EE-44E5-82CC-82E619380D87}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "035-assistants-dotnet", "035-assistants-dotnet\035-assistants-dotnet.csproj", "{E3AACF07-5434-4B5C-820D-B5E1A661C6D5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -22,21 +22,21 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{99F0BCCA-ED5E-4654-937F-C79E7E2130C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99F0BCCA-ED5E-4654-937F-C79E7E2130C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99F0BCCA-ED5E-4654-937F-C79E7E2130C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99F0BCCA-ED5E-4654-937F-C79E7E2130C4}.Release|Any CPU.Build.0 = Release|Any CPU
{A71026F5-ACF4-49FF-94C4-73006234E737}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A71026F5-ACF4-49FF-94C4-73006234E737}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A71026F5-ACF4-49FF-94C4-73006234E737}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A71026F5-ACF4-49FF-94C4-73006234E737}.Release|Any CPU.Build.0 = Release|Any CPU
{4410FBFF-81EE-44E5-82CC-82E619380D87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4410FBFF-81EE-44E5-82CC-82E619380D87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4410FBFF-81EE-44E5-82CC-82E619380D87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4410FBFF-81EE-44E5-82CC-82E619380D87}.Release|Any CPU.Build.0 = Release|Any CPU
{6569C5F1-0230-43E5-9041-1CD4C214F748}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6569C5F1-0230-43E5-9041-1CD4C214F748}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6569C5F1-0230-43E5-9041-1CD4C214F748}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6569C5F1-0230-43E5-9041-1CD4C214F748}.Release|Any CPU.Build.0 = Release|Any CPU
{BF6F92A4-E8B9-4DCB-A851-3E67CEAC4DDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF6F92A4-E8B9-4DCB-A851-3E67CEAC4DDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF6F92A4-E8B9-4DCB-A851-3E67CEAC4DDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF6F92A4-E8B9-4DCB-A851-3E67CEAC4DDC}.Release|Any CPU.Build.0 = Release|Any CPU
{E3AACF07-5434-4B5C-820D-B5E1A661C6D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3AACF07-5434-4B5C-820D-B5E1A661C6D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3AACF07-5434-4B5C-820D-B5E1A661C6D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3AACF07-5434-4B5C-820D-B5E1A661C6D5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{99F0BCCA-ED5E-4654-937F-C79E7E2130C4} = {663030A0-0A93-4565-BEE2-2F356E49FEFA}
{A71026F5-ACF4-49FF-94C4-73006234E737} = {468B4675-71B9-4397-8225-4DDEC46DD4B0}
{6569C5F1-0230-43E5-9041-1CD4C214F748} = {ECF40993-4AD0-441E-93E7-F80E62465259}
{BF6F92A4-E8B9-4DCB-A851-3E67CEAC4DDC} = {FFD3A9CA-B05C-4519-921C-2ECFFC523D74}
EndGlobalSection
EndGlobal

0 comments on commit ab826da

Please sign in to comment.