#pdf #client #api-client #document #api-service #pdf-file #api-request

unstructured-client

Unofficial Unstructured Rust client library

5 releases

0.2.0 Jul 22, 2024
0.1.3 Jul 22, 2024
0.1.2 Jul 19, 2024
0.1.1 Jul 19, 2024
0.1.0 Jul 19, 2024

#1623 in Web programming

Download history 103/week @ 2024-07-23 2/week @ 2024-07-30 2/week @ 2024-09-10 7/week @ 2024-09-24 1/week @ 2024-10-01

166 downloads per month

Apache-2.0

40KB
765 lines

Unofficial Unstructured Rust client library

Use Unstructured's API service with this light client library for Rust.

Usage example

Either use their platform offering, or spin up an Unstructured API service locally:

docker run -p 8000:8000 -it downloads.unstructured.io/unstructured-io/unstructured-api:latest
use unstructured_client::{error::Result, PartitionParameters, UnstructuredClient};

#[tokio::main]
async fn main() -> Result<()> {
    // Specify file path
    let file_path =
        std::path::PathBuf::from("crates/unstructured-cli/tests/fixtures/sample-pdf.pdf");

    // Create an instance of UnstructuredClient
    let client = UnstructuredClient::new("http://localhost:8765")?;

    // Define partition parameters
    let params = PartitionParameters::default();

    // Make the API request
    match client.partition_file(&file_path, params).await {
        Ok(element_list) => println!("{:#?}", element_list),
        Err(error) => eprintln!("Error: {:#?}", error),
    }

    Ok(())
}

Check out partition.rs for the partition arguments.

Dependencies

~5–16MB
~208K SLoC