feat(embeddings): add GITNEXUS_EMBEDDING_OMIT_DIMENSIONS for provider…#2047
Open
CheckPickerUpper wants to merge 3 commits into
Open
feat(embeddings): add GITNEXUS_EMBEDDING_OMIT_DIMENSIONS for provider…#2047CheckPickerUpper wants to merge 3 commits into
CheckPickerUpper wants to merge 3 commits into
Conversation
…s that reject the dimensions field GITNEXUS_EMBEDDING_DIMS drives both the `dimensions` field sent in the request and the length the returned vector is validated against. Some OpenAI-compatible endpoints (e.g. Voyage) reject the `dimensions` field with a 400 while still returning a fixed-size vector, so they cannot be configured today: setting DIMS triggers the 400, and leaving it unset makes validation expect the 384 default and reject the real vector. Add an opt-in GITNEXUS_EMBEDDING_OMIT_DIMENSIONS flag that suppresses only the sent field. DIMS is still honoured for validation. Default behaviour is unchanged.
|
@CheckPickerUpper is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
Adds an opt-in
GITNEXUS_EMBEDDING_OMIT_DIMENSIONSflag so embedding providers that reject thedimensionsrequest field (e.g. Voyage) can be used, while the returned vector length is still validated againstGITNEXUS_EMBEDDING_DIMS.Motivation / context
GITNEXUS_EMBEDDING_DIMSis overloaded: it is both thedimensionsfield sent in the request and the length the returned vector is validated against. Some OpenAI-compatible endpoints reject thedimensionsfield with a 400 while still returning a fixed-size vector. Voyage, for example, returns400 "Argument 'dimensions' is not supported by our API". That leaves no working configuration: setting DIMS triggers the 400, and leaving it unset makes validation expect the 384 default and reject the provider's real 1024-d vector.Areas touched
gitnexus/(CLI / core / MCP server)gitnexus-web/(Vite / React UI).github/(workflows, actions)eval/or other toolingScope & constraints
In scope
GITNEXUS_EMBEDDING_OMIT_DIMENSIONSenv flag (1/true) read in the HTTP embedding client.dimensionsfield, on both the batch (httpEmbed) and single-query (httpEmbedQuery) paths.GITNEXUS_EMBEDDING_DIMSis still honoured to validate the returned vector length.Explicitly out of scope / not done here
Implementation notes
readConfig()gains anomitDimensionsFieldboolean derived from the env var. Both call sites passundefinedfor the request dimensions when it is set, so the field is omitted; the existing validation (config.dimensions ?? DEFAULT_DIMS) is untouched, so a mismatched response is still rejected.Testing & verification
npx vitest run test/unit/http-embedder.test.ts(ingitnexus/): 29/29 pass, including two new cases asserting thedimensionsfield is omitted whenGITNEXUS_EMBEDDING_OMIT_DIMENSIONSis set (batch and single-query paths) and still sent when it is not.tsconfig.json(ingitnexus/): clean, 0 type errors.GITNEXUS_EMBEDDING_URL=https://api.voyageai.com/v1, modelvoyage-code-3,GITNEXUS_EMBEDDING_DIMS=1024,GITNEXUS_EMBEDDING_OMIT_DIMENSIONS=1.gitnexus analyzethengitnexus queryboth succeed. Without the flag,analyzefails with the Voyage 400.Risk & rollout
Opt-in and backward-compatible. With the flag unset, behaviour is unchanged: no migration, no forced re-index. Only users switching to a field-rejecting provider set the flag and re-run
gitnexus analyze.Checklist
AGENTS.md/ overlays changed: N/A, not touched