contracttest

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package contracttest contains deterministic provider-package HTTP contracts. It is internal test infrastructure, not a public runtime API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Anthropic

func Anthropic(t *testing.T, provider llm.Provider, key auth.APIKey, construct Constructor)

Anthropic verifies native Messages JSON/SSE, x-api-key authentication, usage, and finish normalization for a provider that exposes Anthropic semantics.

func AnthropicBearer

func AnthropicBearer(t *testing.T, provider llm.Provider, key auth.APIKey, construct Constructor)

AnthropicBearer verifies native Messages JSON/SSE for gateways that expose Anthropic semantics but deliberately authenticate the whole gateway with a bearer token (for example Cloudflare AI Gateway and Vercel AI Gateway).

func NoDefaultOpenCodeAttribution

func NoDefaultOpenCodeAttribution(t *testing.T, provider llm.Provider, key auth.APIKey, header string, construct OptionConstructor)

NoDefaultOpenCodeAttribution verifies that a gateway does not silently send OpenCode branding headers, while preserving an explicit caller override.

func OpenAI

func OpenAI(t *testing.T, provider llm.Provider, key auth.APIKey, construct Constructor)

OpenAI verifies the common JSON/SSE, auth, usage, finish, and route contract for a provider using the OpenAI Chat Completions dialect.

func OpenAIWithHeader

func OpenAIWithHeader(t *testing.T, provider llm.Provider, key auth.APIKey, header string, construct Constructor)

OpenAIWithHeader is the same contract for providers such as Azure that use a documented API-key header instead of Authorization: Bearer.

func Responses

func Responses(t *testing.T, provider llm.Provider, key auth.APIKey, construct Constructor)

Responses verifies the common OpenAI Responses JSON/SSE, bearer auth, usage, tool/finish normalization, and /responses route contract.

func ResponsesWithHeader

func ResponsesWithHeader(t *testing.T, provider llm.Provider, key auth.APIKey, header string, construct Constructor)

ResponsesWithHeader verifies the Responses dialect for providers such as Azure that use a documented API-key header instead of Authorization: Bearer.

Types

type Constructor

type Constructor func(model.Model, auth.APIKey) (inference.Client, error)

type OptionConstructor

type OptionConstructor func(model.Model, auth.APIKey, ...simple.Option) (inference.Client, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL