(t *testing.T)
| 267 | } |
| 268 | |
| 269 | func TestRequestPayloadInjectTools(t *testing.T) { |
| 270 | t.Parallel() |
| 271 | |
| 272 | payload := mustMessagesPayload(t, `{"model":"claude-opus-4-5","max_tokens":1024,"messages":[{"role":"user","content":"hello"}],"tools":[{"name":"existing_tool","type":"custom","input_schema":{"type":"object","properties":{}},"cache_control":{"type":"ephemeral"}}]}`) |
| 273 | |
| 274 | updatedPayload, err := payload.injectTools([]anthropic.ToolUnionParam{ |
| 275 | { |
| 276 | OfTool: &anthropic.ToolParam{ |
| 277 | Name: "injected_tool", |
| 278 | Type: anthropic.ToolTypeCustom, |
| 279 | InputSchema: anthropic.ToolInputSchemaParam{ |
| 280 | Properties: map[string]interface{}{}, |
| 281 | }, |
| 282 | }, |
| 283 | }, |
| 284 | }) |
| 285 | require.NoError(t, err) |
| 286 | |
| 287 | toolItems := gjson.GetBytes(updatedPayload, "tools").Array() |
| 288 | require.Len(t, toolItems, 2) |
| 289 | require.Equal(t, "injected_tool", toolItems[0].Get("name").String()) |
| 290 | require.Equal(t, "existing_tool", toolItems[1].Get("name").String()) |
| 291 | require.Equal(t, "ephemeral", toolItems[1].Get("cache_control.type").String()) |
| 292 | } |
| 293 | |
| 294 | func TestRequestPayloadConvertAdaptiveThinkingForBedrock(t *testing.T) { |
| 295 | t.Parallel() |
nothing calls this directly
no test coverage detected