Skip to main content

Module request

Module request 

Source
Expand description

Completion requests, normalized responses, and provider model contracts.

use rig_core::completion::CompletionRequest;

let request = CompletionRequest::new("Who are you?")
    .preamble("You are a concise assistant.")
    .temperature(0.5);
assert_eq!(request.temperature, Some(0.5));

Structs§

CompletionRequest
Struct representing a general completion request that can be sent to a completion model provider.
CompletionResponse
Assistant content and normalized completion metadata. The choice may be empty, including for truncated or filtered turns. Provider-specific data is available through Self::raw without retaining a concrete model type.
Cost
What one or more turns cost, in USD. total is what was charged.
Document
ProviderCapabilities
Model capabilities used by runtimes when preparing requests. Defaults are conservative; construct through Self::new and setters.
ProviderToolDefinition
Provider-native tool definition.
ResponseIdentity
Distinct response and transport identifiers for one model call. Unreported identifiers remain None.
ToolDefinition
Usage
The token usage a provider reported for one completion.

Enums§

FinishReason
Normalized generation ending. Unmapped provider values remain in Self::Other. Failure statuses may accompany parseable output; callers must decide whether such output is usable rather than treating every response as successful.