looprs-cli 0.5.1

looprs binary: interactive REPL and scriptable entrypoint
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use looprs::Agent;
use looprs::AgentError;
use std::collections::HashMap;

#[allow(dead_code)]
pub async fn run_single_turn(
    agent: &mut Agent,
    prompt: impl Into<String>,
    metadata: HashMap<String, String>,
) -> Result<String, AgentError> {
    let prompt = prompt.into();
    agent.set_turn_metadata(metadata);
    agent.add_user_message(prompt);
    agent.run_turn().await?;
    Ok(agent
        .latest_assistant_text()
        .unwrap_or_else(|| "No assistant text blocks were returned.".to_string()))
}