-
Notifications
You must be signed in to change notification settings - Fork 87
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
Implement IChatClient #111
Conversation
awaescher
commented
Oct 17, 2024
•
edited
Loading
edited
- Implement IChatClient Implement IChatClient (Microsoft.Extensions.AI) #112
- Add Async-suffix to async methods Code style #81
for the records, I am not a fan of this, see #81
src/MicrosoftAi/AbstractionMapper.cs
Outdated
Properties = functionMetadata.Parameters.ToDictionary(p => p.Name, p => new Properties | ||
{ | ||
Description = p.Description, | ||
Enum = [], // TODO is there such as possible values in AIFunctionParameterMetadata? |
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.
You can use something like Enum.GetValues(p.ParameterType)
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.
Or if you want to be more precise about it, it's possible to use p.Schema
. If it's a JsonElement
, it's telling you the JSON schema, so you could use that to read the set of possible values. That would be more technically correct since it would work regardless of AOT and trimming concerns. However if you want to start with Enum.GetValues(p.ParameterType)
that would be a reasonable starting point.
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.
Thats a nice idea but where can I find how to handle it? What can I check for and what are the possible return values? Got me any resource or a way how to test it?
private static string ToFunctionTypeString(JsonObject? schema)
{
return "string"; // TODO others supported?
}
I'll close the other comments aiming for the same change with this note that the JsonSchema
approach would be good for these methods:
GetPossibleValues()
ToFunctionTypeString()
@awaescher This looks superb to me! |
Important Strongly suggest considering this change to be available in a feature-branch or be a pre-release package Currently Semantic Kernel cannot have a dependency on .Net 9 features yet, if any updates after this merges into main we won't be able to update to your connector until it becomes GA, assume any other customers that also have a hard (.Net 8 LTS) configuration will be in a same position. SK is also adding support for |
I'm not sure this is actually a problem. This change doesn't entail taking a dependency on .NET 9. Microsoft.Extensions.AI.Abstractions is |
@SteveSandersonMS Thanks for the added context, would like to follow more on that info on the |
Co-authored-by: Steve Sanderson <[email protected]>
Co-authored-by: Steve Sanderson <[email protected]>
Awesome. Can we get this earlier, so that I could merge and build 4.0? @RogerBarreto: Semantic Kernel could stay at 3.x after your pull request #114 but should also be able update to 4.x right? |
Published another preview version 4.0.0-preview.9 containing the latest changes from this pull-request. |
You are right, we will update to the 4.0 as soon this feature branch microsoft/semantic-kernel#9183 Is merged in main |
I guess I'll build a 4.0 as soon as Microsoft.Extensions.AI.Abstractions uses |
A new version is up on nuget. |
Awesome, thanks @stephentoub. |