Skip to content

Commit a77be48

Browse files
yishuangPcopybara-github
authored andcommitted
Set content type for tool responses.
LiteRT-LM-PiperOrigin-RevId: 879964350
1 parent 9739359 commit a77be48

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

kotlin/java/com/google/ai/edge/litertlm/Conversation.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,12 @@ class Conversation(
320320
addProperty("name", functionName)
321321
add("response", result)
322322
}
323-
toolResponsesJSONArray.add(toolResponseJSONObject)
323+
val toolResponseWithTypeJSONObject =
324+
JsonObject().apply {
325+
addProperty("type", "tool_response")
326+
add("tool_response", toolResponseJSONObject)
327+
}
328+
toolResponsesJSONArray.add(toolResponseWithTypeJSONObject)
324329
}
325330
return JsonObject().apply {
326331
addProperty("role", "tool")

0 commit comments

Comments
 (0)