Skip to content

Commit

Permalink
OpenAI-DotNet 8.1.2 (#341)
Browse files Browse the repository at this point in the history
- Added constructor overloads to Tool and Function classes to support manually adding tool calls in the conversation history
  • Loading branch information
henduck authored Aug 9, 2024
1 parent 1ed0c2a commit 8fcd8d8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions OpenAI-DotNet/Common/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public Function(string name, string description, string parameters)
Parameters = JsonNode.Parse(parameters);
}

internal Function(string name, JsonNode arguments)
{
Name = name;
Arguments = arguments;
}

private Function(string name, string description, MethodInfo method, object instance = null)
{
if (!Regex.IsMatch(name, NameRegex))
Expand Down
8 changes: 8 additions & 0 deletions OpenAI-DotNet/Common/Tool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -23,6 +24,13 @@ public Tool(Function function)
Type = nameof(function);
}

public Tool(string toolCallId, string functionName, JsonNode functionArguments)
{
Function = new Function(functionName, arguments: functionArguments);
Type = "function";
Id = toolCallId;
}

public Tool(FileSearchOptions fileSearchOptions)
{
Type = "file_search";
Expand Down
4 changes: 3 additions & 1 deletion OpenAI-DotNet/OpenAI-DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ More context [on Roger Pincombe's blog](https://rogerpincombe.com/openai-dotnet-
<AssemblyOriginatorKeyFile>OpenAI-DotNet.pfx</AssemblyOriginatorKeyFile>
<IncludeSymbols>true</IncludeSymbols>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>8.1.1</Version>
<Version>8.1.2</Version>
<PackageReleaseNotes>
Version 8.1.2
- Added constructor overloads to Tool and Function classes to support manually adding tool calls in the conversation history
Version 8.1.1
- Added overloads to Assistant streaming event callbacks to include event name: Func&lt;String, IServerSentEvent, Task&gt;
Version 8.1.0
Expand Down

0 comments on commit 8fcd8d8

Please sign in to comment.