| Crates.io | aristech-nlp-client |
| lib.rs | aristech-nlp-client |
| version | 3.0.1 |
| created_at | 2025-04-01 13:41:57.406213+00 |
| updated_at | 2025-09-19 07:19:44.952299+00 |
| description | A Rust client library for the Aristech Natrual Language Processing API |
| homepage | https://github.com/aristech-de/nlp-clients/blob/main/rust/README.md |
| repository | https://github.com/aristech-de/nlp-clients |
| max_upload_size | |
| id | 1614882 |
| size | 76,294 |
This is the Rust client implementation for the Aristech NLP-Server.
To use the client in your project, add it to your Cargo.toml or use cargo to add it:
cargo add aristech-nlp-client
use aristech_nlp_client::{
get_client, process, TlsOptions, Auth,
nlp_service::{Function, ProcessRawRequest},
};
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut client = get_client(
"https://nlp.example.com",
Some(TlsOptions {
ca_certificate: None,
auth: Some(Auth { token: "your-token", secret: "your-secret" }),
}),
).await?;
let response = process(&mut client, ProcessRawRequest {
input: "hello world".to_string(),
functions: vec![
Function { id: "spellcheck".to_string(), ..Function::default() },
],
..ProcessRawRequest::default()
}).await?;
println!("{}", response.output);
Ok(())
}
There are several examples in the examples directory:
You can run the examples directly using cargo like this:
.env file in the rust directory:HOST=nlp.example.com
# The credentials are optional but probably required for most servers:
TOKEN=your-token
SECRET=your-secret
# The following are optional:
# ROOT_CERT=your-root-cert.pem # If the server uses a self-signed certificate
# If neither credentials nor an explicit root certificate are provided,
# you can still enable SSL by setting the SSL environment variable to true:
# SSL=true
# PROJECT_ID=your-project-id # Required for some examples
cargo run --example functions
To build the library, run:
cargo build