MCPcopy Create free account
hub / github.com/coder/coder / validateAnthropicMessages

Function validateAnthropicMessages

aibridge/internal/integrationtest/mockupstream.go:308–316  ·  view source on GitHub ↗

validateAnthropicMessages validates that an Anthropic messages request has all required fields. See https://github.com/anthropics/anthropic-sdk-go.

(t *testing.T, body []byte, msgAndArgs ...any)

Source from the content-addressed store, hash-verified

306// has all required fields.
307// See https://github.com/anthropics/anthropic-sdk-go.
308func validateAnthropicMessages(t *testing.T, body []byte, msgAndArgs ...any) {
309 t.Helper()
310
311 var req anthropic.MessageNewParams
312 require.NoError(t, json.Unmarshal(body, &req), msgAndArgs...)
313 require.NotEmpty(t, req.Model, "model is required", msgAndArgs)
314 require.NotEmpty(t, req.Messages, "messages is required", msgAndArgs)
315 require.NotZero(t, req.MaxTokens, "max_tokens is required", msgAndArgs)
316}

Callers 1

validateRequestFunction · 0.85

Calls 3

NotEmptyMethod · 0.80
HelperMethod · 0.65
UnmarshalMethod · 0.45

Tested by

no test coverage detected