Skip to content

fix:toolcall return string #2885

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No 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? No Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Cui-xf
Copy link

@Cui-xf Cui-xf commented Apr 25, 2025

Signed-off-by: Cui-xf cui_xf293@qq.com

Thank you for taking time to contribute this pull request!
You might have already read the [contributor guide][1], but as a reminder, please make sure to:

  • Sign the contributor license agreement
  • Rebase your changes on the latest main branch and squash your commits
  • Add/Update unit tests as needed
  • Run a build and make sure all tests pass prior to submission

Signed-off-by: Cui-xf <cui_xf293@qq.com>
@@ -58,6 +58,10 @@ public String convert(@Nullable Object result, @Nullable Type returnType) {
final var imgB64 = Base64.getEncoder().encodeToString(buf.toByteArray());
return JsonParser.toJson(Map.of("mimeType", "image/png", "data", imgB64));
}
else if (result instanceof String stringResult) {
Copy link
Member

@markpollack markpollack Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the current assumption is that if is not a rendered image, we assume it is json (also a string) in this current PR, the json conversion in the else statement will never be accessed. Can you explain more of the surrounding use case that motivated you to make this change? adding to DefaultToolCallResultConverterTests?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wondering why JsonParser.toJson(result); doesn't use Type returnType

No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants