Skip to main content

Crate openkind_core

Crate openkind_core 

Source
Expand description

openkind-core: Zero-dependency, Jev-compatible wire protocol types and validation.

§Overview

openkind-core is the foundational crate in the openkind workspace. It acts as the canonical, single source of truth for the wire schema spoken by both HTTP/REST (/v1/systemone and /v1/system_one) and gRPC (openkind.SystemOne/Evaluate) transports.

Pinned to the TypeSafe Jev API contract documented at https://docs.typesafe.ai/api and the Python SDK specification at https://docs.typesafe.ai/sdk/python/api.

§Architectural Invariants

  • Strict Dependency Layering: openkind-core depends on no other workspace crates (openkind-engine, openkind-api, etc.). All higher layers depend on openkind-core.
  • 64-bit IEEE 754 Precision: All floating-point fields (probabilities, score, noul, confidence) use f64 to prevent wire representation regressions (such as 0.92f32 round-tripping to 0.9200000166893005).
  • Zero Confidence on Noul: Per the Jev specification, boolean probability (Noul) answers contain only noul and never include a confidence field.
  • Polymorphic State & Instructions: state and question instructions allow plain text strings, JSON objects, or JSON arrays.

See docs/ARCHITECTURE.md and crates/openkind-core/schemas/ for generated JSON Schema definitions.

Re-exports§

pub use answer::Answer;
pub use answer::ChoiceAnswer;
pub use answer::NoulAnswer;
pub use answer::ScoreAnswer;
pub use error::validate_request;
pub use error::validate_response;
pub use error::validate_response_for_request;
pub use error::ResponseContract;
pub use error::ValidationError;
pub use error::ValidationResult;
pub use error::MAX_CRITERIA_OPTIONS;
pub use error::MAX_QUESTIONS_PER_REQUEST;
pub use models::ModelInfo;
pub use models::ModelsResponse;
pub use question::ChoiceQuestion;
pub use question::NoulCriteria;
pub use question::NoulQuestion;
pub use question::Question;
pub use question::ScoreQuestion;
pub use request::SystemRequest;
pub use request::WireHashState;
pub use request::API_VERSION;
pub use response::SystemResponse;
pub use response::Usage;
pub use state::State;

Modules§

answer
Wire answer types for Noul, Choice, and Score evaluations. Answer types — one per Question type.
error
Request and response schema validation errors and checks. Validation errors and pure verification routines for the Jev protocol specification.
models
Model metadata structures for /v1/models discovery. ModelInfo and ModelsResponse — match the wire shape on docs.typesafe.ai/models#listing-models.
question
Question descriptors and rubric criteria representations. Question types — Noul, Choice, Score.
request
System evaluation request envelope and versioning constants. Request body. Spec: https://docs.typesafe.ai/api#request-body
response
System evaluation response payload and usage metrics. Response body. Spec: https://docs.typesafe.ai/api#response-body
state
Flexible evaluation state input (text, structured object, or array). state field — the content to evaluate.

Functions§

api_version
Current API version constant. Bumped when the wire schema breaks compat.