feat(compile): allow callers to disable embeddings - #169
feat(compile): allow callers to disable embeddings#169TigerOfCountryYao wants to merge 1 commit into
Conversation
|
Sorry this sat so long without a look. Reviewing it as a draft since it is yours to finish, and the remaining work is small. The feature is worth having, and your PR body undersells it. The description says "callers that maintain an independent semantic index", which invites the obvious objection: why not just withhold the embedding credential? The real answer is better than that, and it is provider-specific:
So for two of the four backends there is no way to compile without embedding except to break chat. That is the case for the flag, and it belongs in the description, because "just unset the key" is the first thing a reviewer will reach for. Scope is right too: Three things to finish. 1. The branch does not build. 2. The test survives the failure it exists to prevent. With the syntax fixed there is one case asserting
It proves 3. The One question rather than a request: there is no Thanks for this, and again for the patience. The instinct is right and the gap is real. |
`finalizeWiki` took `scoped` as a fifth positional boolean, added when the prompt-modifier fingerprint landed (#188). #169 wants a sixth in the same shape, to skip the embedding refresh. Two adjacent defaulted booleans is the wrong place to be. They are the same type, so transposing them type-checks silently, and each one INVERTS a behaviour on a path whose whole point is to do less than the default: a scoped run that must not record the modifier selection as true of the project, and a compile that must not embed. Swapping them produces a compile that does the opposite of what the caller asked, with nothing to catch it. They move into a named `FinalizeFlags` object. One flag was tolerable; a second one arriving is the signal to name them rather than to add a parameter. The next flag is then `flags.x` at the call site and impossible to transpose. No behaviour change. #188's scoped control was mutation-tested through the new shape at both the call site and the destructure, and each mutant is still caught.
|
#192 has landed, so the signature is sorted and you are unblocked. That leaves the two things above: the missing |
`compile({ embeddings: false })` runs page generation, links and the lexical index without any embedding-provider call or pending-embedding retry, for an SDK host that maintains its own semantic index. Omitting it is unchanged.
The gap it closes is provider-specific. With `anthropic` or `claude-agent` a caller can already opt out by not setting `VOYAGE_API_KEY`, but the `openai` embedding credential falls back to `OPENAI_API_KEY` and `ollama` needs no key at all, so those callers had no way to compile without embedding except to break chat.
The flag joins `FinalizeFlags` as `flags.embeddings` rather than becoming a sixth positional boolean beside `scoped`. It is deliberately NOT a prompt modifier: it changes what runs after pages are written, never what a prompt asks for, so it must not enter the modifier digest or invalidate a page that is byte-identical under it.
The original test asserted only that `embeddings: false` skips the refresh, which passes against a build that never refreshes at all. Two cases now pin the default path, and both mutants are caught: skipping unconditionally turns 2 red, ignoring the flag turns 1 red.
Based on #169 by @TigerOfCountryYao, whose commit is preserved in this branch's history.
|
This shipped in #198, merged as Your commit is in the history as you wrote it, rebased onto current Three things changed on the way in. It builds now. The default path is pinned. The original had one case, asserting that It uses One thing worth saying plainly: I argued against building this at first, because no issue requested it and it adds permanent public SDK surface. What changed my mind is the reason your description did not quite make. "Just don't set the embedding credential" only works for two of the four backends - #171 is still open and is the more interesting of the three. I have been looking at it and will follow up there. |
Adds an optional embeddings flag to the compile API. The default remains true for full backward compatibility; callers that maintain an independent semantic index can explicitly pass false. Includes API and compile-path coverage. Verified with TypeScript, build, targeted tests, and changed-scope checks.