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: Support for primitives and complex types by Kernel prompt template #4013

Conversation

SergeyMenshykh
Copy link
Member

@SergeyMenshykh SergeyMenshykh commented Dec 5, 2023

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.

@SergeyMenshykh SergeyMenshykh requested a review from a team as a code owner December 5, 2023 23:20
@shawncal shawncal added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Dec 5, 2023
@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue Dec 6, 2023
Merged via the queue into microsoft:main with commit eb24c40 Dec 6, 2023
17 checks passed
@SergeyMenshykh SergeyMenshykh deleted the types-support-by-kernel-prompt-template branch December 6, 2023 09:26
Bryan-Roe pushed a commit to Bryan-Roe-ai/semantic-kernel that referenced this pull request Oct 6, 2024
…ate (microsoft#4013)

### Motivation and Context

Closes a corresponding task in the -
microsoft#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants