Route documents over 32,000 characters to chunklaya - #113
Merged
Merged
Conversation
An input over MAX_CHARS used to be refused with input_too_long. When CHUNKLAYA_URL and CHUNKLAYA_TOKEN are set and CHUNKLAYA_ENABLED is "true", it is now answered by chunklaya, our own long-document service (Laya behind a chunk-and-index harness, github.com/myxamediyar/chunklaya, serve/), and the result is labelled chunklaya/multilingual. Nothing at or under 32,000 characters changes; an explicit model "jev" keeps its ceiling; model "chunklaya" selects it for shorter text. Unconfigured, the old 400 stands. The service speaks System One, so it is a fourth Backend in src/jev.ts through the bearer transport Beam already uses, with the URL and token read from the environment, one document per request, a 60 s deadline, and no per-token cost (the pod is billed by the hour). Its refusals are reported as chunklaya_input, chunklaya_busy and chunklaya_unavailable in our own words, and never fall back to Jev or the LLM chain. Ceilings: 4,000,000 characters per input, 20 inputs per request, no smart tier. Dimensions pack against the backend's limits so every question about a document travels in one request. Billing prices the model at zero in the rate card, the spending table and the reservation bound. Docs, OpenAPI, MCP and the CLI render the new model and codes from the same constants. The deploy workflow passes CHUNKLAYA_URL and CHUNKLAYA_TOKEN to the Worker when both exist as repository secrets, and leaves them out otherwise. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (18)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
src/index.ts: keep the backend argument on classifyMany together with main's funded-permit condition on the line after it. tests/runtime-config.test.ts asserted the deploy step's secrets file by its old literal; it now asserts what that literal stood for — the pooled DATABASE_URL, the chunklaya pair only when both are set, and no unpooled URL anywhere in the deploy step. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inputs over
MAX_CHARS(32,000 characters) are answered by chunklaya, our own long-document service (myxamediyar/chunklaya,serve/), whenCHUNKLAYA_URLandCHUNKLAYA_TOKENare set andCHUNKLAYA_ENABLEDis"true". Without them, those requests keep answering400 input_too_long, so the change is safe to deploy before the secrets exist.Routing
model: "jev"keeps the 32,000 ceiling;model: "chunklaya"selects the service for shorter text.chunklaya/multilingual.tier: "smart"is refused withbad_tier.chunklaya_input(400),chunklaya_busy(429, Retry-After) andchunklaya_unavailable(503), in our own words. No fallback to Jev or the LLM chain.Transport — a fourth
Backendinsrc/jev.tsover the bearer transport Beam uses: URL and token from the environment, one document per request, 60 s deadline, no per-token provider cost.dimensionspack against its limits so all questions about a document go in one request.Billing — zero rate in
retail-rates.json(version2026-09-23-chunklaya-v3), the spending price table andproviderCallBound.Surfaces — docs (
LONG DOCUMENTS, parameters, error list), OpenAPI (model enum, error codes, limits), MCP enums, CLI (--model chunklaya),wrangler.example.toml, AGENTS.md.Deploy —
deploy.ymlpassesCHUNKLAYA_URLandCHUNKLAYA_TOKENto the Worker when both are repository secrets, and omits them otherwise.Checks —
npm run typecheckclean;npm test797 pass / 0 fail (8 new intest/chunklaya.test.ts);cd cli && node --test27 pass.🤖 Generated with Claude Code
Summary by CodeRabbit
chunklayaas a supported model across the CLI, API, MCP tools, and classification workflows.