Skip to main content
Version: 0.7.2

Functions

aggregate_completion​

def aggregate_completion(raw: Iterator[tuple[int, dict[int, float]]], tokenizer: TokenizerAdapter, request: CompletionRequest, prompt_ids: Sequence[int], eos_token_ids: Sequence[int] | None=None) -> Iterator[CompletionStreamChunk]

Map raw source positions into the former word-level completion stream.

Source: src/invera_sdk/completions.py:432

create_client_with_tokenizer​

def create_client_with_tokenizer(options: InveraClientOptions, tokenizer: TokenizerAdapter) -> InveraClient

Create a high-level client with an advanced host-managed tokenizer.

Source: src/invera_sdk/completions.py:390

create_hugging_face_tokenizer​

def create_hugging_face_tokenizer(identity: TokenizerIdentity) -> TokenizerAdapter

Load the exact Hugging Face tokenizer revision and accept it only if its fingerprint matches.

Source: src/invera_sdk/completions.py:178

decode_raw_attribution_chunk​

def decode_raw_attribution_chunk(payload: Any) -> tuple[int, dict[int, float]]

Decode one raw NDJSON object into a token id and summed source-position scores.

Source: src/invera_sdk/completions.py:399

parse_qwen_tool_calls​

def parse_qwen_tool_calls(chunks: Iterator[CompletionStreamChunk], tool_parser: str) -> Iterator[CompletionStreamChunk]

Split Qwen <tool_call> markers into typed compatibility chunks.

tool_parser is one of SUPPORTED_TOOL_PARSERS: the Engine's sdk_hints.recommended_tool_parser for the model that produced chunks.

Source: src/invera_sdk/completions.py:468

stream_evidence​

def stream_evidence(chunks: Iterator[CompletionStreamChunk], request: CompletionRequest, options: EvidenceOptions | None=None, *, tool_parser: str | None) -> Iterator[EvidenceStreamEvent]

Add claim and tool-call evidence to an attributed completion stream.

tool_parser names the format of the tool calls in chunks: the Engine's sdk_hints.recommended_tool_parser for the model that produced them, one of SUPPORTED_TOOL_PARSERS. None (the model recommends no parser) accepts only streams without tool calls.

Source: src/invera_sdk/evidence.py:231