query_with_timeout

Function query_with_timeout 

Source
pub async fn query_with_timeout(
    prompt: &str,
    timeout_secs: f64,
) -> Result<String>
Expand description

Simple synchronous query to iFlow with custom timeout

Sends a query to iFlow and waits for a complete response. This is a convenience function for simple request-response interactions.

§Arguments

  • prompt - The query prompt to send to iFlow
  • timeout_secs - Timeout in seconds

§Returns

  • Ok(String) containing the response from iFlow
  • Err(IFlowError) if there was an error

§Example

use iflow_cli_sdk_rust::query_with_timeout;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let response = query_with_timeout("What is 2 + 2?", 120.0).await?;
    println!("{}", response);
    Ok(())
}