Skip to main content

respond

Function respond 

Source
pub async fn respond<P>(prompt: P) -> Result<String, Error>
where P: TryInto<Prompt>, P::Error: Into<Error>,
Expand description

Sends a single prompt to the model and returns the response text.

Each call creates a fresh session with no prior context. For multi-turn conversations use LanguageModelSession directly.

ยงErrors

Returns Error::NullByte for prompt text that cannot cross the C FFI boundary, Error::Unavailable when Apple Intelligence is unavailable, or Error::Generation when the model or bridge fails.