Expand description
Async HTTP client for the native Basal endpoint (POST /v1/basal).
Reuse a Client to share its connection pool. The server validates requests and computes decisions;
this crate preserves native probabilities and confidence. No GPU runtime or automatic retries are needed.
See examples/decide.rs for usage. Dropping an in-flight future cancels the client-side request.
Macros§
- questions
- Build a named request shape with inferred, checked answer fields.
Structs§
- ActAnswer
- Checked act answer.
- ActKind
- Result marker for Act questions.
- ActOptions
- Act options. Omitted criteria use true/false outcomes.
- Answer
- Native answer. Fields used by other question types are absent. Unknown fields are retained in
extra. - Batch
- Durable batch state; nullable timestamps are Unix seconds. Future status strings remain readable.
- Batch
Error Entry - A batch-level validation error.
- Batch
Errors - Bounded list of validation errors.
- Batch
Expires After - Retention of each output/error file from its creation.
- Batch
Input Line - One JSONL input record. Serialize each record followed by LF; upload exact bytes if already encoded.
- Batch
List Options - Limits and cursor of one list request. The SDK never auto-paginates.
- Batch
Page - One cursor page, ordered by creation time and id descending.
- Batch
Request Counts - Counts after validation. Failed also includes expired records.
- Batch
Result Error - Non-execution error of a result record.
- Batch
Result Line - One result JSONL line; native success and error response bodies remain arbitrary JSON objects.
- Batch
Result Response - Response portion of a result line.
- Batch
Results - Result cursor. Buffers one file at a time; parsing does not create a second collection of all records.
No background task or connection is retained between
nextcalls. Dropping an in-flightnextcancels that request; discard the cursor after cancellation rather than resuming uncertain I/O. - Batch
Results Options - Per-file buffering allowance for the results cursor.
- Batch
Wait Options - Explicit polling settings. The deadline covers both retrieval requests and sleeps.
- Batches
- Batches resource. Workflow polling happens only on an explicit
waitcall. - Choice
Answer - Checked choice answer.
- Choice
Kind - Result marker for Choice questions.
- Choice
Options - Choice display options.
- Claim
Result - Per-claim calibrated verdict.
- Classify
Answer - Checked single- or multi-label classification.
- Classify
Kind - Result marker for Classify tasks.
- Classify
Options - Experimental classification options.
- Client
- 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.
- Client
Options - Connection configuration. The API key is intentionally not printable through
Debug. - Compress
Answer - Checked extractive compression.
- Compress
Kind - Result marker for Compress tasks.
- Compress
Options - Extractive compression options.
- Compression
Unit - One compression unit in the original text.
- Create
Batch From Requests - A simplified create request. The SDK serializes and uploads these records before creating the batch. JSONL is buffered in memory, limited to 50,000 records and 200 MB; the upload adds a multipart copy.
- Create
Batch Request - Create a batch from an uploaded JSONL input. Use
Self::newfor native defaults. - Decision
Options - Decision routing/preprocessing options.
- Decision
Request - Native inference request. A missing model uses the server’s default; basal-rs accepts a model name.
- Decision
Response - Native inference result keyed by question ID.
- Deleted
File - Confirmation of a file deletion.
- Dynamic
Schema - Schema for a runtime-keyed
Questionsmap. - Evidence
Options - Supporting spans for noul and score.
- Evidence
Span - Supporting span in the original state.
- Extract
Answer - Checked structured extraction.
- Extract
Field - Extracted field, including missing values and source provenance.
- Extract
Kind - Result marker for Extract tasks.
- File
Object - One stored input or result file. Timestamps are Unix seconds.
- File
Upload Options - Optional upload retention. The input itself is always uploaded with purpose
batch. - Files
- Files resource. Borrows the pooled client; never opens local paths or remote URLs.
- Media
Input - One inline media item, in request order.
- Media
Usage - Media accounting reported by the server.
- Model
Metadata - Model metadata. The exact
nameis accepted by basal-rs as a request’s model. - Models
Response - Model discovery result.
- Multi
Answer - Checked multi answer.
- Multi
Kind - Result marker for Multi questions.
- Multi
Options - Multi options intentionally have no evidence field.
- Noul
Answer - Checked yes/no answer.
- Noul
Kind - Result marker for Noul questions.
- Prepared
Questions - Ordered question definitions together with their named response shape.
Usually constructed by
crate::questions!. - Question
- Native question. Criteria and cost matrices are JSON objects or arrays; preserve their order.
Additional native fields (including future extensions) go in
extra. - Question
Spec - Immutable typed question definition. It can be reused under multiple request keys.
- Questions
- Ordered heterogeneous request builder. Request keys identify answers, not definition identity.
- Score
Answer - Checked score answer.
- Score
Kind - Result marker for Score questions.
- Tool
Answer - Checked tool routing answer. This SDK never executes a selected tool.
- Tool
Kind - Result marker for Tool questions.
- Tool
Options - Tool routing options. Definitions are normalized and validated by the server.
- Tool
Ranking - A ranked tool candidate.
- Typed
Decision Response - Validated response retaining request keys and an optional named answer shape.
- Usage
- Server-reported usage, with native extension fields retained.
- Verify
Answer - Checked claim verification.
- Verify
Kind - Result marker for Verify tasks.
- Verify
Options - Experimental verification options.
Enums§
- Answer
Result - Checked answer selected by a runtime question key.
- Batch
Create Input - Mutually exclusive input paths for
Batches::create. Prefer theFromconversions at the call site. - Batch
Operation Error - Typed failures of the opt-in workflow helpers. Debug/Display omit documents, bodies and keys.
- Compression
Unit Kind - Compression segmentation.
- Error
- Typed SDK failures. Display and Debug omit response bodies and transport details.
- Extract
Calibration - Extraction calibration scope; span products are not certified field probabilities.
- Extract
Source - Extraction decision source.
- Facts
Mode - Native facts preprocessing mode.
- Language
- Explicit prompt language.
- Media
Detail - Image resolution budget.
- Media
Kind - Supported inline input kinds.
- Multi
Objective - Multi-set selection objective.
- Option
Keys - Display named criterion keys.
- Question
Type - A native question type.
- Tool
Extra - Optional non-tool choices.
- Verdict
- Claim verification verdict.
Traits§
- Answer
Kind - Closed association between a question and its required result fields.
- Answer
Schema - Constructs borrowed answer fields for a request shape.
- Question
Set - Request questions accepted by
crate::Client::decide.
Functions§
- act
- Act over true/false outcomes with default options.
- act_
with_ options - Select an action from a full cost matrix. Omitted criteria use true/false outcomes.
- choice
- Choose from 2–255 options with default display settings.
- choice_
with_ options - Choose one of 2–255 ordered named options.
- classify
- Classify using a label object or ordered list, normalized by the server.
- compress
- Compress verbatim source units; the model chooses units, it does not generate text.
- extract
- Extract enum, boolean, scalar and nested object fields from a JSON schema.
- multi
- Multi selection with default threshold and no count limits.
- multi_
with_ options - Select labels independently; options have no evidence.
- noul
- Yes/no probability with default options.
- noul_
with_ options - Read a yes/no probability.
- score
- Score over ordered levels with default options.
- score_
with_ options - Score over 2–255 ordered text levels.
- tool
- Select one tool with default options; does not execute it.
- tool_
with_ options - Select tools from OpenAI, MCP or Anthropic definition objects.
- verify
- Verify an ordered map or list of claims.
Type Aliases§
- ActQuestion
- A typed act question.
- Automation
- Certified automation by requested error target.
Noneis an unavailable task certificate. - Choice
Question - A typed choice question.
- Classify
Question - Classification question definition.
- Compress
Question - Compression question definition.
- Cost
Matrix - Explicit action/outcome cost matrix.
- Extract
Question - Extraction question definition.
- Multi
Question - A typed multi question.
- Noul
Question - A typed yes/no question.
- Score
Question - A typed score question.
- Tool
Question - Tool routing definition.
- Verify
Question - Verification question definition.