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§
- Choice
Logprobs - Logprob information attached to a choice.
- Extended
Chat Request - A full OpenAI-compatible chat completion request including all optional fields.
- Extended
Chat Response - A full OpenAI-compatible chat completion response.
- Extended
Choice - A single completion choice that may include logprobs and tool calls.
- Function
Call Result - The result of a function call — name and serialized arguments.
- Function
Definition - A function that can be called by the model.
- Function
Name - A function identified by name only.
- Json
Schema Format - A named JSON schema that the model output must conform to.
- Logprobs
Content - Log probability information for a single generated token.
- Named
Tool Choice - A specific tool choice identifying a function by name.
- Response
Format - The format in which the model should return its response.
- Tool
- A tool that can be used during generation.
- Tool
Call - A tool call made by the model in the response.
- Tool
Call Result - A tool call produced by the model in a chat completion response.
- Tool
Definition - A tool available to the model (OpenAI-compatible format).
- Tool
Function - A function definition for tool use.
- Tool
Function Call - A function call made by the model (name + serialised arguments).
- TopLogprob
- A top-k alternative token and its log probability.
- Usage
Info - Token usage information for a completion request.
Enums§
- Stop
Sequences - One or more stop sequences that terminate generation.
- Tool
Choice - 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
trueiftextis valid JSON (object or array). - parse_
tool_ call - Attempt to parse a tool call from generated text.