semantic-kernel
semantic-kernel copied to clipboard
Request to Return Additional Information in CompleteAsync Method and Store it in ContextVariables
Currently, the CompleteAsync method only returns a response string. I would like to request that additional information such as status codes be returned as well.
I suggest that the CompleteAsync method in ITextCompletion should return some type T instead of a string to allow for this. This would enable us to gather more information about the response and make it easier to handle different scenarios.
Furthermore, I would like to propose that the ContextVariables class be updated to use a ConcurrentDictionary<string, object> instead of ConcurrentDictionary<string, string>. This would allow for the storage of variables of different types and make the class more flexible.
Please let me know if these changes are feasible and if there are any concerns or suggestions for improvement. Thank you for your time and consideration.
Thanks for the feedback the team is looking into this.
@DavidLuong98: one more upvote this this request.
@DavidLuong98 this PR #952 and #1117 addresses the first and second requests on this Issue.
Now you can get more detailed information about your requests using the ModelResults property of SKContext variable when calling RunAsync or InvokeAsync.
On the ITextCompletion interfaces we now have a method to return a ITextCompletionResult (being renamed to ITextResult on #1391)
This IResult interface exposes also the ModelResult property which you can use a extension method to get more info of it in this example: Example43_GetModelResult
@DavidLuong98, can you confirm if the PRs that @RogerBarreto mentioned address the challenges you faced? :)
@RogerBarreto @matthewbolanos Looks good, thank you both.