You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If the Content-Type header of a REST API JSON response includes a charset (e.g. Content-Type: application/json; charset=utf-8), the Handlebars prompt template handles the response as a string instead of as deserialized JSON.
To Reproduce
The issue appears to be due to how the Content-Type is matched here:
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
Resolves#5127: If the Content-Type header of a REST API JSON response
includes a charset (e.g. Content-Type: application/json; charset=utf-8),
the Handlebars prompt template handles the response as a string instead
of as deserialized JSON.
This PR changes the check from strict equality to a check that determine
if the content type simply contains `application/json`
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
Describe the bug
If the
Content-Type
header of a REST API JSON response includes acharset
(e.g.Content-Type: application/json; charset=utf-8
), the Handlebars prompt template handles the response as a string instead of as deserialized JSON.To Reproduce
The issue appears to be due to how the
Content-Type
is matched here:semantic-kernel/dotnet/src/Extensions/PromptTemplates.Handlebars/Helpers/KernelHelpers/KernelFunctionHelpers.cs
Lines 211 to 221 in fe29d1a
Expected behavior
The JSON response should be deserialized.
Platform
Microsoft.SemanticKernel.PromptTemplates.Handlebars
version1.4.0
The text was updated successfully, but these errors were encountered: