Add JSON serialization to LLM message types

Message, Part (Text/Image/File), ToolCall, FunctionCall, and Usage
now round-trip through JSON. Message uses a type-discriminated
envelope for the Part interface. Required for checkpoint persistence.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-04-10 18:52:50 +02:00
parent d955489d11
commit 19a2610056
4 changed files with 237 additions and 14 deletions

View File

@@ -65,8 +65,8 @@ type (
FinishReason string
Usage struct {
InputTokens int
OutputTokens int
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
}
ChatCompletionResponse struct {