Skip to main content

Module api_types

Module api_types 

Source
Expand description

Extended OpenAI-compatible API types.

Provides request/response types for full OpenAI API compatibility including function calling (tools), logprobs, JSON mode, and multi-completion support.

Structs§

ChoiceLogprobs
Logprob information attached to a choice.
ExtendedChatRequest
A full OpenAI-compatible chat completion request including all optional fields.
ExtendedChatResponse
A full OpenAI-compatible chat completion response.
ExtendedChoice
A single completion choice that may include logprobs and tool calls.
FunctionCallResult
The result of a function call — name and serialized arguments.
FunctionDefinition
A function that can be called by the model.
FunctionName
A function identified by name only.
JsonSchemaFormat
A named JSON schema that the model output must conform to.
LogprobsContent
Log probability information for a single generated token.
NamedToolChoice
A specific tool choice identifying a function by name.
ResponseFormat
The format in which the model should return its response.
Tool
A tool that can be used during generation.
ToolCall
A tool call made by the model in the response.
ToolCallResult
A tool call produced by the model in a chat completion response.
ToolDefinition
A tool available to the model (OpenAI-compatible format).
ToolFunction
A function definition for tool use.
ToolFunctionCall
A function call made by the model (name + serialised arguments).
TopLogprob
A top-k alternative token and its log probability.
UsageInfo
Token usage information for a completion request.

Enums§

StopSequences
One or more stop sequences that terminate generation.
ToolChoice
Controls which tool (if any) is called by the model.

Functions§

compute_logprobs
Compute logprob information for the chosen token, including top-k alternatives.
fingerprint_from_config
Compute a stable hex fingerprint from a model configuration value.
generate_tool_call_id
Generate a unique tool call identifier with the call_ prefix.
is_valid_json
Return true if text is valid JSON (object or array).
parse_tool_call
Attempt to parse a tool call from generated text.