Skip to content

Commit

Permalink
.Net: Support DateTime parameters in tools for Assistants API #9940 (#…
Browse files Browse the repository at this point in the history
…10037)

I have implemented support for DateTime parameters in the .NET tools for
the Assistants API. The approach ensures compatibility while maintaining
the overall design principles of the semantic-kernel.

This contribution reflects my dedication to making the semantic-kernel
more versatile and my enthusiasm for contributing meaningful
improvements to open-source projects.

Contribution Checklist
 The code builds cleanly without errors or warnings.
 All unit tests pass.

Co-authored-by: Mark Wallace <[email protected]>
Co-authored-by: Chris <[email protected]>
  • Loading branch information
3 people authored Jan 6, 2025
1 parent 118cc5b commit 5471eb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ private static string ConvertType(Type? type)
return "array";
}

if (type == typeof(DateTime) || type == typeof(DateTimeOffset))
{
return "date-time";
}

return Type.GetTypeCode(type) switch
{
TypeCode.SByte or TypeCode.Byte or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void TestFunction1() { }
[KernelFunction]
[Description("test description")]
#pragma warning disable IDE0060 // Unused parameter for mock kernel function
public void TestFunction2(string p1, bool p2, int p3, string[] p4, ConsoleColor p5, OpenAIAssistantDefinition p6) { }
public void TestFunction2(string p1, bool p2, int p3, string[] p4, ConsoleColor p5, OpenAIAssistantDefinition p6, DateTime p7) { }
#pragma warning restore IDE0060 // Unused parameter
}
}

0 comments on commit 5471eb3

Please sign in to comment.