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§
- Completion
Request - Struct representing a general completion request that can be sent to a completion model provider.
- Completion
Response - Assistant content and normalized completion metadata. The choice may be
empty, including for truncated or filtered turns. Provider-specific data is
available through
Self::rawwithout retaining a concrete model type. - Cost
- What one or more turns cost, in USD.
totalis what was charged. - Document
- Provider
Capabilities - Model capabilities used by runtimes when preparing requests.
Defaults are conservative; construct through
Self::newand setters. - Provider
Tool Definition - Provider-native tool definition.
- Response
Identity - Distinct response and transport identifiers for one model call.
Unreported identifiers remain
None. - Tool
Definition - Usage
- The token usage a provider reported for one completion.
Enums§
- Finish
Reason - 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.