#[non_exhaustive]pub struct CompletionRequest {
pub rendered_prompt: String,
pub output_schema: Option<Value>,
pub execution_hints: ExecutionHints,
}Expand description
A single LLM completion request.
The caller is responsible for rendering the prompt — the trait does
not own the template surface. output_schema is optional: leaving it
None means “free-form text” and the adapter will treat the response
as a raw string wrapped into crate::response::CompletionResponse::parsed_output.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.rendered_prompt: StringFully-rendered prompt string the model should consume as user
input. The trait deliberately carries a single string here
rather than a system/user split: providers that distinguish
roles can split the rendered prompt at a marker. If a future
provider needs role-tagged or multi-part input, the trait must
grow a structured input type rather than overloading this
field — #[non_exhaustive] on this struct keeps that path open.
output_schema: Option<Value>Optional JSON Schema 2020-12 document describing the expected
output shape. When present, adapters pass it through to the
provider’s structured-output API (Ollama format, OpenAI
response_format.json_schema.schema, etc.). When absent the
model is unconstrained and the adapter wraps any returned text
into crate::response::CompletionResponse::parsed_output as a JSON string.
execution_hints: ExecutionHintsGeneration hints. All fields are optional; adapters apply each hint only if the provider’s API supports it.
Implementations§
Source§impl CompletionRequest
impl CompletionRequest
Sourcepub fn new(rendered_prompt: impl Into<String>) -> Self
pub fn new(rendered_prompt: impl Into<String>) -> Self
Build a request with just a rendered prompt; no schema, default hints. Use this for free-form text completion.
Sourcepub fn with_output_schema(self, schema: Value) -> Self
pub fn with_output_schema(self, schema: Value) -> Self
Builder-style setter for output_schema.
Sourcepub fn with_execution_hints(self, hints: ExecutionHints) -> Self
pub fn with_execution_hints(self, hints: ExecutionHints) -> Self
Builder-style setter for execution_hints.
Trait Implementations§
Source§impl Clone for CompletionRequest
impl Clone for CompletionRequest
Source§fn clone(&self) -> CompletionRequest
fn clone(&self) -> CompletionRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more