.Net: Support for primitives and complex types by Kernel prompt template #4013
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Closes a corresponding task in the - #3692 issue.
This update is the next step in making it possible to use primitive and complex data types in SK. Currently, the kernel prompt template can only work with strings. This PR makes it possible to use other basic types like int, decimal, bool, object, etc... and complex types as well.
For an easy review experience, this PR introduces duplication for object-to-string conversion functionality. The duplication will be addressed in follow-up PR shortly afterward.
Limitation: Since the kernel prompt template is being modified to support primitives, it would be logical to expect an expression like this one in a prompt: {{p.f a=28}}, where the number 28 is specified without single or double quotes and eventually passed to the function as an integer argument, avoiding unnecessary string-to-int conversion. However, supporting this expression would require modifications to the
CodeTokenizer
class, which is beyond the scope of this PR. The issue - https://github.com/orgs/microsoft/projects/866/views/1?pane=issue&itemId=46702719 has been created to track this case.