Skip to main content

chat

Function chat 

Source
pub async fn chat(
    client: &Client,
    model: &ModelConfig,
    system: &str,
    user: &str,
    tool_loop: Option<&ToolLoopConfig>,
    verbose: bool,
    color: Style,
    stream_stdout: bool,
    usage: &mut Usage,
    turn_timeout: Duration,
    interrupted: Arc<AtomicBool>,
) -> Result<String>
Expand description

Run a chat turn with an optional tool loop. Returns the final assistant text. Every request’s token usage is summed into usage (the tool loop makes one request per iteration).