Declare
A typed function or API schema defines one narrow responsibility.
NEOSYNTROPY FRAMEWORK / DECLARATIVE AI
Add a decorator to a typed Python function. Start with foundation-model intelligence, collect evaluated examples, and tune a small specialist model—without changing the function your application calls.
A ROUTER OVER YOUR FUNCTIONS
Give SemanticRouter a labeled list of decorated functions. It chooses only from that list, and every unmatched request follows your explicit fallback.
pip install neosyntropyrouter = SemanticRouter(routes={
"refund": quote_refund, "tracking": track_order,
}, fallback_node=human_handoff)DECLARATIVE TUNING / SMALL MODELS
The decorator is the contract—not a black box. Start with a foundation model, collect evaluated examples, then tune a small model for that exact function. Your Python call stays the same.
How model-backed nodes work ↗Only executions that pass the schema, critic, and review gates enter the task-specific dataset.
A typed function or API schema defines one narrow responsibility.
Schema checks and critics turn evaluated executions into a reviewed training set.
NeoSyntropy trains a lightweight adapter on a compact base model.
The same contract runs on your specialized model inside the controlled runtime.
You keep the contract, the execution path, and the audit trail. The model behind the node can improve without rewriting the application around it.
RUNTIME MODELS / YOUR PROGRAM
Each node starts with general intelligence, learns from evaluated runs, and becomes a small specialist for one responsibility. Your graph, schemas, functions, and policies remain the contract.
Extract typed values that must match your application schema.
extract = SchemaNode("ExtractRefund",
input_schema=OpenInput,
output_schema=RefundTicket,
prompt="Extract the refund request.",
)Reason with only the context and tools you explicitly allow.
reason = ReasoningNode("CheckPolicy",
input_schema=OpenInput,
prompt="Check the refund policy.",
tools=("lookup_order",),
)Choose one labeled function and fall back when nothing fits.
router = SemanticRouter(id="SupportIntent",
input_schema=OpenInput,
routes={"refund": refund,
"tracking": track_order},
fallback_node=human_handoff,
)Run deterministic business policy before an action can commit.
@functional_validation_node(output_key="policy_ok")
def validate(ctx):
return ctx.state["amount"] <= 100Score useful outcomes and feed evaluated runs back into tuning.
@functional_kpi_node(output_key="accuracy")
def accuracy(ctx):
return 1.0 if ctx.state["accepted"] else 0.0FROM DECLARATION TO EXECUTION
Compose nodes into a Workflow or FSM. Define permitted edges and guards, execute with your project client, and inspect runs in the console. Schema validation checks structure; application policy checks whether an action should proceed.