-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Added M.E.A.I. AIFunction Generation support #24
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
Changes from 10 commits
e101bac
e289da0
315af73
36cf256
904bbf0
6bfd9b7
1ebee3f
46a569b
d245705
8071875
234c61e
d8a5f36
4075971
28da355
8830a3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -110,39 +110,49 @@ public static OpenApiSchema ConvertToSchema<T>(JsonSerializerOptions? jsonOption | |||||
| public static OpenApiSchema ConvertToSchema(JsonTypeInfo type, string descriptionString) | ||||||
| { | ||||||
| var typeInfo = type; | ||||||
|
|
||||||
| var dics = JsonSerializer.Deserialize(descriptionString,OpenApiSchemaJsonContext.Default.IDictionaryStringString); | ||||||
|
|
||||||
| var dics = JsonSerializer.Deserialize(descriptionString, | ||||||
| OpenApiSchemaJsonContext.Default.IDictionaryStringString); | ||||||
| List<string> required = new List<string>(); | ||||||
| var x = ConvertToCompatibleSchemaSubset(typeInfo.GetJsonSchemaAsNode(exporterOptions:new JsonSchemaExporterOptions() | ||||||
| { | ||||||
| TransformSchemaNode = (a, b) => | ||||||
| var x = ConvertToCompatibleSchemaSubset(typeInfo.GetJsonSchemaAsNode( | ||||||
| exporterOptions: new JsonSchemaExporterOptions() | ||||||
| { | ||||||
| if (a.PropertyInfo == null) | ||||||
| return b; | ||||||
| var propName = ToCamelCase(a.PropertyInfo.Name); | ||||||
| if (dics.ContainsKey(propName)) | ||||||
| TransformSchemaNode = (a, b) => | ||||||
| { | ||||||
| b["description"] = dics[propName]; | ||||||
| } | ||||||
| return b; | ||||||
| }, | ||||||
| })); | ||||||
| if (a.TypeInfo.Type.IsEnum) | ||||||
| { | ||||||
| b["type"] = "string"; | ||||||
| } | ||||||
|
|
||||||
| if (a.PropertyInfo == null) | ||||||
| return b; | ||||||
| var propName = ToCamelCase(a.PropertyInfo.Name); | ||||||
| if (dics.ContainsKey(propName)) | ||||||
| { | ||||||
| b["description"] = dics[propName]; | ||||||
| } | ||||||
|
|
||||||
| return b; | ||||||
| }, | ||||||
| })); | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
| foreach (var re in x.Properties) | ||||||
| { | ||||||
| required.Add(re.Key); | ||||||
| } | ||||||
|
|
||||||
| var mainDescription =x.Description ?? dics["mainFunction_Desc"]; | ||||||
|
|
||||||
| var mainDescription = x.Description ?? dics["mainFunction_Desc"]; | ||||||
|
||||||
| var mainDescription = x.Description ?? dics["mainFunction_Desc"]; | |
| var mainDescription = x.Description ?? (dics.TryGetValue("mainFunction_Desc", out var desc) ? desc : ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing import for Tool class
The code adds JSON serialization for
ToolandList<Tool>types, but there's no import statement for theToolclass. This could cause compilation errors.📝 Committable suggestion