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. - Choice
Answer - Checked choice answer.
- Choice
Kind - Result marker for Choice questions.
- Choice
Options - Choice display 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. - 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.
- Dynamic
Schema - Schema for a runtime-keyed
Questionsmap. - Evidence
Options - Supporting spans for noul and score.
- Evidence
Span - Supporting span in the original state.
- 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.
Enums§
- Answer
Result - Checked answer selected by a runtime question key.
- Error
- Typed SDK failures. Display and Debug omit response bodies and transport details.
- 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.
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.
- 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.
Type Aliases§
- ActQuestion
- A typed act question.
- Choice
Question - A typed choice question.
- Cost
Matrix - Explicit action/outcome cost matrix.
- Multi
Question - A typed multi question.
- Noul
Question - A typed yes/no question.
- Score
Question - A typed score question.
- Tool
Question - Tool routing definition.