Skip to main content

Crate basal_client

Crate basal_client 

Source
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.
ChoiceAnswer
Checked choice answer.
ChoiceKind
Result marker for Choice questions.
ChoiceOptions
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.
ClientOptions
Connection configuration. The API key is intentionally not printable through Debug.
DecisionOptions
Decision routing/preprocessing options.
DecisionRequest
Native inference request. A missing model uses the server’s default; basal-rs accepts a model name.
DecisionResponse
Native inference result keyed by question ID.
DynamicSchema
Schema for a runtime-keyed Questions map.
EvidenceOptions
Supporting spans for noul and score.
EvidenceSpan
Supporting span in the original state.
MediaInput
One inline media item, in request order.
MediaUsage
Media accounting reported by the server.
ModelMetadata
Model metadata. The exact name is accepted by basal-rs as a request’s model.
ModelsResponse
Model discovery result.
MultiAnswer
Checked multi answer.
MultiKind
Result marker for Multi questions.
MultiOptions
Multi options intentionally have no evidence field.
NoulAnswer
Checked yes/no answer.
NoulKind
Result marker for Noul questions.
PreparedQuestions
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.
QuestionSpec
Immutable typed question definition. It can be reused under multiple request keys.
Questions
Ordered heterogeneous request builder. Request keys identify answers, not definition identity.
ScoreAnswer
Checked score answer.
ScoreKind
Result marker for Score questions.
ToolAnswer
Checked tool routing answer. This SDK never executes a selected tool.
ToolKind
Result marker for Tool questions.
ToolOptions
Tool routing options. Definitions are normalized and validated by the server.
ToolRanking
A ranked tool candidate.
TypedDecisionResponse
Validated response retaining request keys and an optional named answer shape.
Usage
Server-reported usage, with native extension fields retained.

Enums§

AnswerResult
Checked answer selected by a runtime question key.
Error
Typed SDK failures. Display and Debug omit response bodies and transport details.
FactsMode
Native facts preprocessing mode.
Language
Explicit prompt language.
MediaDetail
Image resolution budget.
MediaKind
Supported inline input kinds.
MultiObjective
Multi-set selection objective.
OptionKeys
Display named criterion keys.
QuestionType
A native question type.
ToolExtra
Optional non-tool choices.

Traits§

AnswerKind
Closed association between a question and its required result fields.
AnswerSchema
Constructs borrowed answer fields for a request shape.
QuestionSet
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.
ChoiceQuestion
A typed choice question.
CostMatrix
Explicit action/outcome cost matrix.
MultiQuestion
A typed multi question.
NoulQuestion
A typed yes/no question.
ScoreQuestion
A typed score question.
ToolQuestion
Tool routing definition.