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

unstructured-client

非官方Unstructured Rust客户端库

5个版本

0.2.0 2024年7月22日
0.1.3 2024年7月22日
0.1.2 2024年7月19日
0.1.1 2024年7月19日
0.1.0 2024年7月19日

#1338Web编程

Download history 177/week @ 2024-07-13 311/week @ 2024-07-20 22/week @ 2024-07-27

每月510次下载

Apache-2.0

40KB
765

非官方Unstructured Rust客户端库

使用此轻量级Rust客户端库与Unstructured的API服务。

使用示例

可以使用他们的平台产品,或者本地启动Unstructured API服务

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("https://127.0.0.1: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(())
}

查看partition.rs中的分区参数。

依赖项

~4–19MB
~228K SLoC