Skip to content

About

The compatibility harness for kime. The TypeSafe (Jev) API and SDKs, jev-ultrafast and Laya's own clients and tests, run against kime so that drop in replacement is a number rather than a promise.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

kime-compat

The compatibility harness for kime.

kime promises that code written for TypeSafe's Jev or for Laya works against it with a base URL or an import changed and nothing else. This repository is where that promise becomes a number: the TypeSafe API and SDKs, jev-ultrafast, and Laya's own clients and tests, run against kime.

It is a separate repository for the same reason the benchmarks are: someone who doubts the claim should be able to run the check without trusting the engine's own test suite. The design is the API compatibility section of spec/15-testing.md in the kime repository.

Where kime is, today

Four things run. The response contract (the rules from spec/03-api.md that clients actually break on) is checked on the committed fixtures, and on what a running kime-serve answers to the same requests: answer order matches question order, probability keys are exactly the offered labels, rounded probabilities sum to exactly one, choice is an argmax, score is the expected level, legend echoes the criteria, model is never an alias, nothing is ever generated, and /v1/models has the shape the TypeSafe SDKs parse. The TypeSafe JS SDK examples in sdk-js/ run against kime-serve with @typesafe-ai/sdk 0.6.0 unmodified, under Node 20 and Bun. sdk-python/run.py sends the committed requests through typesafe-sdk 0.7.1, with its sync and async clients, and checks that its typed parsing takes every answer, that /v1/models parses, and that an unknown model raises TypeSafeNotFoundError. Laya's own tests run against the kime package, see below.

CI builds kime-serve from tamnd/kime main on the laya checkpoint and runs both through ci/against-kime.sh, and the kime repository runs the same script on its own changes.

The surfaces

Surface What passes Starts
TypeSafe OpenAPI Every response validates against the committed /openapi.json snapshot, and Schemathesis generated requests are all accepted M1
TypeSafe Python SDK The committed requests replay through typesafe-sdk 0.7.1 against kime-serve, sync and async, and its typed parsing succeeds M1
TypeSafe JS SDK The examples run against kime-serve under Node 20 and Bun M1
jev-ultrafast validate_choice passes on 10,000 generated agent steps, and the Wikipedia example runs end to end with jev-latest unchanged M1
Laya Python API Laya's own test suite passes against the kime package, except the files listed in laya-suite/expected.tsv M1
laya-serve clients The curl examples give the same response shape, and the same answers within parity tolerance on the compat models M1
Error bodies A snapshot for every error status in spec/03-api.md M1
The response contract Every committed fixture obeys the rules clients depend on M0

The same list is in surfaces.tsv, which is what the harness reads.

cargo run -- surfaces
cargo run -- fixtures
cargo run --release -- live http://127.0.0.1:8000 [texts.json]
ci/against-kime.sh path/to/kime path/to/models node bun

live sends each committed request to a running server as jev-latest, since a request with no model is laya-serve's dialect, and checks the answers with the same rules, and that usage.input_tokens is what Laya counts for the fixtures in fixtures/usage.tsv. With a JSON list of strings it also asks each fixture's questions about every text, which is how the contract gets checked on real inputs and not only the three written by hand.

Laya's own tests

ci/laya-suite.sh downloads the Laya 0.3.20 sdist, checks its hash, and runs each of its 46 test files against the kime package, as a script and under pytest when it has test functions. The laya package in laya-suite/shim stands in for Laya: it maps Laya's public modules (the package, agent, router, lang, shortlist, structured, email, presets and onnx_agent) onto kime, so the test files run unchanged. The run routes on Laya's word lists alone, so Laya's routing tests apply as written.

laya-suite/expected.tsv says what each file does against kime and why, and the script fails when a file does anything else, a pass included. Today 9 files pass (the router, routing batches, language guessing, structured decisions, email, blank lang routing and the context manager), 5 skip for an extra that is not installed, and 32 fail. The failures import torch and Laya's DecisionModel, Laya's private helpers, its hooks, CLI, MCP or FastAPI server, or read files the sdist does not ship, and 7 of them fail on Laya itself for that reason. Laya passes 35 of the 46 through the same script with LAYA_SUITE_SHIM=0.

ci/laya-suite.sh path/to/python-with-kime path/to/models

Contributing

A new case is a directory under fixtures/<surface>/ with a request.json and a response.json. A client that breaks against kime is the most useful report this repository can get: open it in tamnd/kime with the compatibility template, and the fixture that shows it lands here.

cargo fmt --all --check, cargo clippy --all-targets and cargo test must pass, and the tests include the prose rules: plain English, no em dashes or en dashes, no horizontal rules, and no sentence broken across two lines.

License

Apache-2.0. See LICENSE-APACHE.

About

The compatibility harness for kime. The TypeSafe (Jev) API and SDKs, jev-ultrafast and Laya's own clients and tests, run against kime so that drop in replacement is a number rather than a promise.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages