Function run_functions

Source
pub async fn run_functions(
    client: &mut NlpClient,
    request: RunFunctionsRequest,
) -> Result<RunFunctionsResponse, Box<dyn Error>>
Expand description

Processes the given text with the specified function pipeline.

§Arguments

  • client - The client to use to communicate with the server.
  • request - The request to send to the server.

§Example

use aristech_nlp_client::{get_client, process, TlsOptions};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let mut client = get_client("https://nlp.example.com".to_string(), Some(TlsOptions::default())).await?;
    let request = ProcessRawRequest {
        input: "Hello, world!".to_string(),
        functions: vec![
            Function { id: "spellcheck-de".to_string(), ..Function::default() },
        ],
       ..ProcessRawRequest::default()
    };
    let response = run_functions(&mut client, request).await?;
    println!("{}", response.output);
    Ok(())
}