pub struct Client { /* private fields */ }Expand description
Cloneable, pooled HTTP/1 client with verified TLS. No redirects, automatic retries or environment proxies. DNS hostnames must be ASCII (use punycode for IDN). A Tokio runtime is required for requests.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn upload_file(
&self,
filename: &str,
data: &[u8],
options: FileUploadOptions,
) -> Result<FileObject, Error>
pub async fn upload_file( &self, filename: &str, data: &[u8], options: FileUploadOptions, ) -> Result<FileObject, Error>
Upload caller-owned JSONL bytes (at most 200 MB); memory includes a multipart copy of the input. No file paths or URLs are opened. Expiry fields precede the file part.
Sourcepub async fn list_files(
&self,
options: BatchListOptions<'_>,
purpose: Option<&str>,
) -> Result<BatchPage<FileObject>, Error>
pub async fn list_files( &self, options: BatchListOptions<'_>, purpose: Option<&str>, ) -> Result<BatchPage<FileObject>, Error>
Read one page of files; optional purpose is batch or batch_output.
Sourcepub async fn delete_file(&self, id: &str) -> Result<DeletedFile, Error>
pub async fn delete_file(&self, id: &str) -> Result<DeletedFile, Error>
Delete a file (the server may retain physical bytes until guarded cleanup).
Sourcepub async fn download_file(&self, id: &str) -> Result<Vec<u8>, Error>
pub async fn download_file(&self, id: &str) -> Result<Vec<u8>, Error>
Download exact JSONL bytes, bounded by ClientOptions::max_response_bytes (default 8 MiB).
Increase that explicit cap when downloading larger files. Dropping the future cancels I/O.
Sourcepub async fn create_batch(
&self,
request: &CreateBatchRequest,
idempotency_key: Option<&str>,
) -> Result<Batch, Error>
pub async fn create_batch( &self, request: &CreateBatchRequest, idempotency_key: Option<&str>, ) -> Result<Batch, Error>
Create a batch; an optional owner-scoped idempotency key is 1–128 visible ASCII bytes. Retrying is the caller’s decision; reuse the same key only with the same request.
Sourcepub async fn list_batches(
&self,
options: BatchListOptions<'_>,
) -> Result<BatchPage<Batch>, Error>
pub async fn list_batches( &self, options: BatchListOptions<'_>, ) -> Result<BatchPage<Batch>, Error>
Read one page of batches.
Sourcepub async fn get_batch(&self, id: &str) -> Result<Batch, Error>
pub async fn get_batch(&self, id: &str) -> Result<Batch, Error>
Retrieve a batch without polling.
Sourcepub async fn cancel_batch(&self, id: &str) -> Result<Batch, Error>
pub async fn cancel_batch(&self, id: &str) -> Result<Batch, Error>
Request cancellation; partial result files may be published later.
Sourcepub async fn batch_health(&self) -> Result<Value, Error>
pub async fn batch_health(&self) -> Result<Value, Error>
Read Batch health. The server exposes this route without authentication.
Source§impl Client
impl Client
Sourcepub fn new(base_url: &str) -> Result<Self, Error>
pub fn new(base_url: &str) -> Result<Self, Error>
Connect to a server root with the default timeout and no authentication.
Sourcepub fn with_options(options: ClientOptions<'_>) -> Result<Self, Error>
pub fn with_options(options: ClientOptions<'_>) -> Result<Self, Error>
Validate configuration and build a connection pool. TLS uses an explicit per-client ring provider and the platform’s certificate verifier; no process-global crypto provider is installed.
Sourcepub async fn decide<Q: QuestionSet>(
&self,
state: impl Into<Value>,
questions: &Q,
) -> Result<TypedDecisionResponse<Q::Schema>, Error>
pub async fn decide<Q: QuestionSet>( &self, state: impl Into<Value>, questions: &Q, ) -> Result<TypedDecisionResponse<Q::Schema>, Error>
Decide from a JSON state and typed question builder.
Sourcepub async fn decide_with_options<Q: QuestionSet>(
&self,
state: impl Into<Value>,
questions: &Q,
options: DecisionOptions<'_>,
) -> Result<TypedDecisionResponse<Q::Schema>, Error>
pub async fn decide_with_options<Q: QuestionSet>( &self, state: impl Into<Value>, questions: &Q, options: DecisionOptions<'_>, ) -> Result<TypedDecisionResponse<Q::Schema>, Error>
Typed decision with explicit model/facts options.
Sourcepub async fn decide_request(
&self,
request: &DecisionRequest,
) -> Result<DecisionResponse, Error>
pub async fn decide_request( &self, request: &DecisionRequest, ) -> Result<DecisionResponse, Error>
POST /v1/basal. Request fields and capability limits are validated by the server.
Sourcepub async fn models(&self) -> Result<ModelsResponse, Error>
pub async fn models(&self) -> Result<ModelsResponse, Error>
GET /v1/models.