Skip to main content

Module api_extensions

Module api_extensions 

Source
Expand description

Extended /v1/chat/completions handler.

Adds support for tools (function calling), logprobs, n > 1 completions, response format constraints (JSON mode / JSON Schema), stop sequences, and frequency/presence penalties on top of the base server implementation.

Structs§

JsonModeEnforcer
Wraps generation to produce valid JSON output.
StopChecker
Detects and truncates text at stop sequences.

Functions§

apply_frequency_penalty
Apply frequency and presence penalties in-place to a logit vector.
extended_chat_completions
Handler for POST /v1/chat/completions/extended.
generate_n_completions
Generate n independent completions from the same prompt, seeding each run with base_seed + i for determinism.