pub struct ModelOptions {
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub extra: BTreeMap<String, Value>,
pub structured: Option<Value>,
}Expand description
Model options for one conversation.
Common parameters are provided as typed fields (temperature / max tokens,
where None means vendor default); vendor-specific or framework-unknown
parameters go into extra and are passed through
to the vendor verbatim under their wire field names — so users can use new
parameters without waiting for a framework update:
use molo::ModelOptions;
let mut options = ModelOptions::default();
options.extra.insert("top_p".into(), serde_json::json!(0.9));Extra keys that collide with framework-managed fields are ignored in favor of the typed fields.
Fields§
§temperature: Option<f32>Sampling temperature; None means vendor default.
max_tokens: Option<u32>Maximum number of tokens for the reply; None means vendor default.
extra: BTreeMap<String, Value>Vendor extension parameters: keys are wire request field names, serialized into the request body verbatim.
structured: Option<Value>Structured output: the final answer must be JSON conforming to this
JSON Schema document (the serialized RootSchema produced by
schemars, or a hand-written schema).
Two layers of semantics:
- Provider side: compatible endpoints receive it via
response_formatto best-effort constrain the model (the OpenAI-compatiblejson_schemashape; unsupported endpoints ignore it or error); - Agent side: the final answer is validated framework-side, and on mismatch the validation error is fed back to the model for a retry (counted against the turn budget by the agent runtime’s structured output support).
None = free-form text reply.
Trait Implementations§
Source§impl Clone for ModelOptions
impl Clone for ModelOptions
Source§fn clone(&self) -> ModelOptions
fn clone(&self) -> ModelOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more