Skip to main content

response_text

Function response_text 

Source
pub fn response_text(result: &Value) -> &str
Expand description

Extract the assistant’s text reply from an invoke_llm / stream_llm result.

Both helpers return {"messages": [response]}. This function digs out the content field of the last message so callers don’t repeat the same .get("messages") … .last() … .get("content") chain every time.

§Example

let result = stream_llm(model, &input, "You are a planner.").await?;
let text = response_text(&result);
println!("LLM said: {}", text);