Inference.Testkit.AdapterCase (inference v0.2.0)

Copy Markdown View Source

Conformance helpers for adapter tests.

Summary

Functions

assert_capability_contract(adapter, opts \\ [])

@spec assert_capability_contract(
  module(),
  keyword()
) :: [Inference.Capability.t()]

Asserts an adapter reports well-formed capabilities before dispatch.

:require names capabilities the adapter must report at all; a registry can then read the claim instead of dispatching to find out.

assert_provider_error(arg)

@spec assert_provider_error({:error, Inference.Error.t()}) :: Inference.Error.t()

assert_redacts_metadata(metadata)

@spec assert_redacts_metadata(map()) :: map()

assert_response_format_contract(adapter, opts \\ [])

@spec assert_response_format_contract(
  module(),
  keyword()
) :: :ok

Asserts an adapter honors the closed response-format union.

For every format the adapter must either return a response (it mapped the format onto a real provider option) or refuse with a typed :response_format_unsupported 2-tuple. Silently dropping a declared format — the historical bug — is a conformance failure.

assert_text_completion(adapter, opts \\ [])

@spec assert_text_completion(
  module(),
  keyword()
) :: Inference.Response.t()

assert_trace_metadata(response)

@spec assert_trace_metadata(Inference.Response.t()) :: map()

assert_unsupported_stream(adapter, opts \\ [])

@spec assert_unsupported_stream(
  module(),
  keyword()
) :: Inference.Error.t()