Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Fix 5796 function calling enum params #5998

Conversation

Krzysztof318
Copy link
Contributor

@Krzysztof318 Krzysztof318 commented Apr 24, 2024

Motivation and Context

Fixes #5796

Description

Type for enum wasn't correctly set in JsonSchemaMapper, it didn't matter for OpenAI but gemini was throwing exception if type isn't specified. Fixed that with string type.
Added new unit tests for Gemini and OpenAI. Both passed.

@RogerBarreto
@SergeyMenshykh

DataHelper and BertOnyx was updated automatically by formatter.

Contribution Checklist

…nnector in the `GeminiFunctionCallingTests.cs` file. These tests verify that the interface can correctly handle enum parameters when using the `TimePlugin`.
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels Apr 24, 2024
@github-actions github-actions bot changed the title Fix 5796 function calling enum params .Net: Fix 5796 function calling enum params Apr 24, 2024
The previous code handled a specific case for string enum converter values where it would assign a JsonSchemaType without assigning the format. This has been simplified by defaulting schemaType to JsonSchemaType.String, and assigning the format to "enum" when values are present. This change ensures that the schema type assignment is more straightforward and consistent.
New test `CanAutoInvokeKernelFunctionsWithEnumTypeParametersAsync` is added to OpenAI tool tests. This test uses the added TimePlugin to ask about last Friday's date. TimePlugin is designed to match the last day given a week day name, using a provided TimeProvider and format.
@Krzysztof318 Krzysztof318 marked this pull request as ready for review April 24, 2024 21:38
@Krzysztof318 Krzysztof318 requested a review from a team as a code owner April 24, 2024 21:38
…ram-exception

# Conflicts:
#	dotnet/src/IntegrationTests/Connectors/OpenAI/OpenAIToolsTests.cs
@markwallace-microsoft
Copy link
Member

@Krzysztof318 could you take a look at the build error? Thanks.

@Krzysztof318
Copy link
Contributor Author

@markwallace-microsoft until 19.05 I am out of office

@RogerBarreto RogerBarreto added this pull request to the merge queue May 13, 2024
Merged via the queue into microsoft:main with commit 8a8cd95 May 13, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: Done
Development

Successfully merging this pull request may close these issues.

.Net: Gemini function calling throws error when a kernel function with Enum parameter is available
5 participants