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: Replace stj-schema-mapper source code with M.E.AI schema generation #9807

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

eiriktsarpalis
Copy link
Member

@eiriktsarpalis eiriktsarpalis commented Nov 25, 2024

Replaces the source copied implementation from https://github.com/eiriktsarpalis/stj-schema-mapper with the equivalent component now made available through Microsoft.Extensions.AI.Abstractions.

cc @RogerBarreto @stephentoub @SergeyMenshykh

@eiriktsarpalis eiriktsarpalis requested a review from a team as a code owner November 25, 2024 16:33
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel documentation labels Nov 25, 2024
@github-actions github-actions bot changed the title Replace stj-schema-mapper source code with M.E.AI schema generation .Net: Replace stj-schema-mapper source code with M.E.AI schema generation Nov 25, 2024
@@ -22,16 +22,20 @@ namespace Microsoft.SemanticKernel;
internal static class KernelJsonSchemaBuilder
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't remove this class to minimize churn, but at this point it seems reasonable to bake in this factory into KernelJsonSchema (and perhaps make it public).

@@ -15,12 +14,12 @@ namespace SemanticKernel.Connectors.OpenAI.UnitTests.Core;
/// </summary>
public sealed class OpenAIJsonSchemaTransformerTests
{
private static readonly JsonSchemaMapperConfiguration s_jsonSchemaMapperConfiguration = new()
private static readonly AIJsonSchemaCreateOptions s_jsonSchemaCreateOptions = new()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These unit test are testing implementation detail that has now been removed. I'll fix the failing build but will otherwise leave these as-is since they're testing the same configuration as the one being passed to the core client.

@@ -95,8 +95,8 @@ public void ItCanConvertToFunctionDefinitionsWithParameterTypesAndReturnParamete
{ "type": "object",
"required": ["param1", "param2"],
"properties": {
"param1": { "type": "string", "description": "String param 1" },
"param2": { "type": "integer", "description": "Int param 2" } } }
"param1": { "description": "String param 1", "type": "string" },
Copy link
Member Author

@eiriktsarpalis eiriktsarpalis Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in the assertion reflect the fact that the new component inserts the description keyword at the start of the schema object. This reflects convention from JSON schema even though they are equivalent -- property order isn't significant in JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: In Review
Development

Successfully merging this pull request may close these issues.

2 participants