Conversion

protoverta.convert_request(body, source, target, *, messages_mid_system=False, public_reasoning=False, text_logprobs=False, responses_penalties=False)[source]

Convert JSON input, including stream requests; reject unsupported semantics.

Parameters:
Return type:

dict[str, Any]

protoverta.convert_response(body, source, target, *, public_reasoning=False, request_context=None, text_logprobs=False, max_top_logprobs=None, omit_reasoning=False)[source]

Convert a completed text/function response without inventing usage.

omit_reasoning is an explicit policy that drops upstream reasoning the target route cannot represent instead of rejecting the response.

Parameters:
Return type:

dict[str, Any]

class protoverta.Protocol(*values)[source]

Bases: StrEnum

Wire protocol of a request or response: chat (Chat Completions), messages (Anthropic Messages) or responses (OpenAI Responses).

CHAT = 'chat'
MESSAGES = 'messages'
RESPONSES = 'responses'
exception protoverta.ConversionError[source]

Bases: ValueError

A request cannot be converted without changing its meaning.

exception protoverta.UnsupportedFeatureError(feature)[source]

Bases: ConversionError

Recognized wire semantics without an equivalent enabled target mapping.

Parameters:

feature (str)

Return type:

None

protoverta.bind_response_context(request)[source]

Freeze portable Responses request metadata; never infer omitted policy.

This checks metadata types, not upstream compliance or response provenance. Validate the full request using convert_request before sending it upstream.

Parameters:

request (dict[str, Any])

Return type:

Callable[[dict[str, Any]], dict[str, Any]]

class protoverta.ToolNameMap[source]

Bases: object

Rebuild deterministic aliases from definitions, history and forced choice.

Create one instance per request. Native forwarding must not use this policy.