| 35 | } |
| 36 | |
| 37 | func TestRecord_OpenAI(t *testing.T) { |
| 38 | s := NewStore() |
| 39 | rawJSON := []byte(`{ |
| 40 | "model": "gpt-4", |
| 41 | "messages": [], |
| 42 | "tools": [ |
| 43 | {"type": "function", "function": {"name": "ls", "parameters": {"type": "object", "properties": {"path": {"type": "string"}}}}} |
| 44 | ] |
| 45 | }`) |
| 46 | |
| 47 | s.Record(rawJSON, "openai") |
| 48 | tools := s.List() |
| 49 | |
| 50 | if len(tools) != 1 { |
| 51 | t.Fatalf("expected 1 tool, got %d", len(tools)) |
| 52 | } |
| 53 | if tools[0].Name != "ls" || tools[0].Format != "openai" { |
| 54 | t.Errorf("unexpected tool: %+v", tools[0]) |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | func TestRecord_NoTools(t *testing.T) { |
| 59 | s := NewStore() |