Skip to content

feat: add experimental self-hosted Laya classifier - #12

Merged
ruban-24 merged 4 commits into
mainfrom
feat/laya-classifier
Sep 27, 2026
Merged

ruban-24 merged 4 commits into
mainfrom
feat/laya-classifier

Conversation

@ruban-24

@ruban-24 ruban-24 commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Add an experimental laya classifier provider for a user-run Laya laya-serve server (System One API). Task text goes only to that server. The routing policy is unchanged.

  • Questions: Laya gets its own short question set sized for the English checkpoint's 512-token input: task type, capability tier, sufficient context with neutral A/B labels, and one model-agnostic effort question. Answers normalize into the same classification as Jev's.
  • Confidence: reads Laya's calibrated answer_confidence, not its entropy-based confidence field.
  • Task length: Laya silently cuts tasks past its 512-token input, so at most 700 characters are sent and a longer task is marked as lacking context (uncertain fallback).
  • Transport: plain fetch with no retries or redirects; the response is read incrementally and abandoned past 256 KiB; response bodies stay out of errors. Defaults to http://127.0.0.1:8000 and the english model. A key is optional on loopback; any other host requires HTTPS and a key.
  • Setup: offered in switchboard init; doctor accepts a keyless local server. LAYA_API_KEY is removed from native CLI environments through one shared list of classifier secret variables.
  • Docs: setup on macOS and Linux (install, first-run download, GPU flags, keeping the server running, background options upstream), key and transport rules, privacy, README, contributor source map, and changelog.

Experimental: routing quality has not been evaluated against Jev. In early synthetic checks Laya's confidence stayed below the default 0.70 thresholds, so routine tasks were raised to the standard tier. The docs state this.

Rebased onto main after #9 and #10; the Laya provider appears in the config menu's classifier connection step.

Validation: all 311 tests passed on this branch rebased onto main (after #9 and #10); npm run test:package passed type checking, build, isolated global installation, npx execution, initialization, and policy validation. Checked by hand against a live laya-serve 0.3.20: setup without a key, routing (confidence below 0.70 raised to the standard tier), the long-task fallback, and the classifier-unavailable fallback when the server is unreachable.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T07:42:51.350693Z 2ead6cf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ead6cfe34

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/laya.ts Outdated
Comment thread src/laya.ts Outdated
ruban-24 and others added 4 commits September 27, 2026 19:54
Add a `laya` provider for a user-run laya-serve (System One API). Laya
gets its own short question set sized for the English checkpoint's
512-token input: neutral A/B context labels and one model-agnostic
effort question. Its answers normalize into the same Classification
as Jev's, and the policy is unchanged.

- Read Laya's calibrated answer_confidence, not its entropy-based
  confidence field.
- Use plain fetch with no retries or redirects, and keep response
  bodies out of errors.
- Default to http://127.0.0.1:8000 and the english model. A key is
  optional on loopback; any other host requires HTTPS and a key.
- Offer Laya in init; doctor accepts a keyless local server.
- Remove LAYA_API_KEY from native CLI environments via one shared list
  of classifier secret variables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Explain how to run laya-serve on macOS and Linux and connect it
through init. Cover the key and transport rules, Laya's shorter
question set and confidence field, and its unevaluated routing
quality. Update privacy, README support lists, the contributor source
map, and the changelog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Note that laya-serve must stay running while Switchboard is in use,
what happens when it is unreachable, and where Laya documents running
it in the background.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Laya gives each question up to 192 tokens and the task the rest of its
512-token input, silently cutting longer tasks. Switchboard now sends at
most 700 characters (about 2.4 characters per token on paths and dense
code with Laya's tokenizer) and marks a longer task as lacking context,
so it takes the uncertain fallback instead of routing on its beginning.

The response-size limit ran only after response.text() buffered the whole
body. The body is now read incrementally and cancelled once it passes the
limit, and an oversized Content-Length is rejected before reading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ruban-24
ruban-24 force-pushed the feat/laya-classifier branch from acb4f41 to 11d45f3 Compare September 27, 2026 09:55
@ruban-24
ruban-24 merged commit b2f9d07 into main Sep 27, 2026
10 checks passed
@ruban-24
ruban-24 deleted the feat/laya-classifier branch September 27, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant