blob: bfa5cc607aff9d4400d30863c13b820a4f649b0d [file] [log] [blame]
Philip Zeyliger72252cb2025-05-10 17:00:08 -07001package llm
2
3import (
4 "testing"
5)
6
7func TestToolResultArray(t *testing.T) {
8 // Test a tool result with multiple content items
9 textContent := Content{
10 Type: ContentTypeText,
11 Text: "15 degrees",
12 }
13
14 imageContent := Content{
15 Type: ContentTypeText, // In the future, this could be ContentTypeImage
16 Text: "",
17 MediaType: "image/jpeg",
18 Data: "/9j/4AAQSkZJRg...", // Base64 encoded image sample
19 }
20
21 toolResult := Content{
22 ToolResult: []Content{textContent, imageContent},
23 }
24
25 // Check the structure
26 if len(toolResult.ToolResult) != 2 {
27 t.Errorf("Expected 2 content items in ToolResult, got %d", len(toolResult.ToolResult))
28 }
29
30 if toolResult.ToolResult[0].Text != "15 degrees" {
31 t.Errorf("Expected first item text to be '15 degrees', got '%s'", toolResult.ToolResult[0].Text)
32 }
33
34 if toolResult.ToolResult[1].MediaType != "image/jpeg" {
35 t.Errorf("Expected second item media type to be 'image/jpeg', got '%s'", toolResult.ToolResult[1].MediaType)
36 }
37}