Closed kayhantolga closed 10 months ago
It looks fine to me except that due to the change you did the RunChatFunctionCallTest and RunChatFunctionCallTestAsStream tests fail now.
The lines in both functions:
Tools = new List<ToolDefinition> { new() { Function = fn1 }, new() { Function = fn2 }, new() { Function = fn3 }, new() { Function = fn4 }, new() { Function = fn4 } },
Needs to change to:
Tools = new List<ToolDefinition> { new() { Type = StaticValues.CompletionStatics.ToolType.Function, Function = fn1 }, new() { Type = StaticValues.CompletionStatics.ToolType.Function, Function = fn2 }, new() { Type = StaticValues.CompletionStatics.ToolType.Function, Function = fn3 }, new() { Type = StaticValues.CompletionStatics.ToolType.Function, Function = fn4 }, new() { Type = StaticValues.CompletionStatics.ToolType.Function, Function = fn4 } },
Writing a nice helper method like ToolChoice.FunctionChoice for ToolDefinition would be nice. e.g.
public class ToolDefinition
{
public static ToolDefinition FunctionTool(FunctionDefinition function) =>new()
{
Type = StaticValues.CompletionStatics.ToolType.Function,
Function = function
};
Then we could write:
Tools = new List<ToolDefinition> { ToolDefinition.FunctionTool(fn1), ToolDefinition.FunctionTool(fn2), ToolDefinition.FunctionTool(fn3), ToolDefinition.FunctionTool(fn4) },
https://github.com/betalgo/openai/pull/444 @shanepowell
@belaszalontai @shanepowell and others, please take a look before merging while I focus on the final details. Let me know if you are unhappy with any changes or have any doubts.