Skip to main content

Crate a3s_apofasi

Crate a3s_apofasi 

Source
Expand description

A3S Apofasi — typed System-1 decisions for A3S hosts.

Apófasi (απόφαση) means decision. This crate owns fast, non-generative typed decisions (choice, score, noul) that hosts can route, gate, and specialize without parsing free-form model text.

The public request / response types match the TypeSafe System One (Jev) JSON contract: state + questions map in, model + answers map + usage out.

§Quick start

use a3s_apofasi::{Client, Criteria, DecisionKind, Question, State, SystemOneRequest};
use indexmap::IndexMap;
use serde_json::json;

let mut opts = IndexMap::new();
opts.insert("billing".into(), Some(json!("refunds")));
opts.insert("other".into(), Some(json!("else")));
let mut questions = IndexMap::new();
questions.insert(
    "department".into(),
    Question::new(
        DecisionKind::Choice,
        json!("Which department?"),
        Some(Criteria::Choice(opts)),
    )
    .unwrap(),
);
let res = Client::default()
    .system_one(SystemOneRequest {
        model: None,
        state: State::Text("Please refund my invoice.".into()),
        questions,
    })
    .unwrap();
assert!(res.answers.contains_key("department"));

Default builds stay small: the lexical engine has no ML framework dependency. Enable infer (and optionally metal / cuda) for Candle neural System-1.

See ARCHITECTURE.md.

Re-exports§

pub use client::Client;
pub use confidence::confidence_from_probs;
pub use confidence::temp_bucket;
pub use confidence::TemperatureTable;
pub use decode::answer_from_logits;
pub use decode::softmax;
pub use detect::analyse;
pub use detect::Detection;
pub use engine::DecisionEngine;
pub use engine::LexicalEngine;
pub use error::Error;
pub use error::Result;
pub use gate::any_escalate;
pub use gate::gate_answer;
pub use gate::gate_response;
pub use gate::GateAction;
pub use gate::GatePolicy;
pub use primitive::DecisionKind;
pub use reward::ece_score;
pub use reward::proper_reward;
pub use reward::RewardWeights;
pub use route::CheckpointId;
pub use route::RouteDecision;
pub use schema::criterion_text;
pub use schema::instructions_text;
pub use schema::Answer;
pub use schema::Criteria;
pub use schema::Instructions;
pub use schema::Question;
pub use schema::State;
pub use schema::SystemOneRequest;
pub use schema::SystemOneResponse;
pub use schema::TokenUsage;
pub use sequence::pack_question;
pub use sequence::pack_question_with_state_ids;
pub use sequence::ByteTokenizer;
pub use sequence::PackedQuestion;
pub use sequence::SequenceConfig;
pub use sequence::SpecialTokens;
pub use sequence::Tokenize;
pub use router::Router;

Modules§

client
In-process System One client.
confidence
Confidence and temperature calibration helpers.
decode
Decode option logits into Jev-compatible Answer values.
detect
Dependency-free script / language detection for checkpoint routing.
engine
Decision engines: trait + lean default lexical scorer.
error
Error types for Apofasi core operations.
gate
Host gating helpers: decide auto vs escalate from typed answers.
primitive
Decision primitive kinds.
reward
Strictly proper scoring-rule rewards (RLCD core math).
route
Routing metadata types (always available; selection logic is feature-gated).
router
Checkpoint router — selection only, no model load.
schema
System One request / response schema aligned with TypeSafe Jev.
sequence
Sequence packing for typed decision prompts.

Constants§

VERSION
Crate version string.