Skip to content

Add Novita as an embeddings provider option - #75

Open
jax-novita wants to merge 1 commit into
raroque:mainfrom
jax-novita:add-novita-provider
Open

jax-novita wants to merge 1 commit into
raroque:mainfrom
jax-novita:add-novita-provider

Conversation

@jax-novita

Copy link
Copy Markdown

Summary

Adds NOVITA_API_KEY as a third paid embeddings provider option in server/embeddings.ts, tried after Voyage/OpenAI and before the local Transformers.js fallback.

Changes

  • server/embeddings.ts: new embedNovita() helper (same shape as embedOpenAI()), plus one NOVITA_API_KEY check each in activeProvider(), embed(), and preloadLocalModel(). Uses baai/bge-m3 via Novita's OpenAI-compatible /openai/v1/embeddings endpoint, which returns 1024-dim vectors — matching the existing Convex vector index requirement, so no schema changes.
  • debug/src/components/EmbeddingBanner.tsx: adds "novita" to the Status["provider"] union and its label.
  • .env.example, README.md: documents NOVITA_API_KEY alongside the existing Voyage/OpenAI options.
  • CHANGELOG.md: adds an Unreleased entry per CONTRIBUTING.md.

Verification

  • npm run typecheck / npm test: same pre-existing failures before and after (missing convex/_generated/api.js, generated by convex dev); no new errors, no regressions in the 31 passing tests.
  • Ran embed() / activeProvider() directly from this repo's own server/embeddings.ts with only NOVITA_API_KEY set (no Voyage/OpenAI keys): activeProvider() returned "novita", and embed() returned a real 1024-dim vector from a live call to Novita's /openai/v1/embeddings endpoint.

Boop's embeddings wrapper tries providers in order: Voyage, then
OpenAI, then falls back to a local Transformers.js model. This adds
Novita's OpenAI-compatible embeddings endpoint (baai/bge-m3) as a
third paid option, tried after OpenAI and before the local fallback.
Novita's endpoint returns 1024-dim vectors, matching the existing
Convex vector index requirement, so no schema changes are needed.
@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds Novita as the third paid embeddings provider, using baai/bge-m3 before the local Transformers.js fallback.

  • Extends provider selection, embedding requests, and local-model preload behavior for NOVITA_API_KEY.
  • Adds the Novita provider label to the debug embedding banner.
  • Documents the new environment variable and provider ordering.

Confidence Score: 4/5

The setup flow should be updated before merging because selecting Local can retain a Novita key and continue paid embedding requests.

The new provider-selection branch activates any retained NOVITA_API_KEY, while setup neither offers Novita nor clears that key when Local is selected.

Files Needing Attention: server/embeddings.ts and scripts/setup.ts

Important Files Changed

Filename Overview
server/embeddings.ts Adds Novita request and selection logic, but the new environment-key branch is not coordinated with the interactive setup flow.
debug/src/components/EmbeddingBanner.tsx Correctly extends the dashboard’s provider union and exhaustive label map for Novita.
.env.example Documents the Novita key and provider order, although setup does not yet expose or consistently clear that key.
README.md Updates user-facing provider documentation consistently.
CHANGELOG.md Records the new provider and its 1024-dimensional model output.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  S[Embedding request] --> V{VOYAGE_API_KEY?}
  V -->|Yes| Voyage[Voyage]
  V -->|No| O{OPENAI_API_KEY?}
  O -->|Yes| OpenAI[OpenAI]
  O -->|No| N{NOVITA_API_KEY?}
  N -->|Yes| Novita[Novita baai/bge-m3]
  N -->|No| Local[Local BGE-large]
Loading

Reviews (1): Last reviewed commit: "Add Novita as an embeddings provider opt..." | Re-trigger Greptile

Comment thread server/embeddings.ts
export function activeProvider(): EmbeddingProvider {
if (process.env.VOYAGE_API_KEY) return "voyage";
if (process.env.OPENAI_API_KEY) return "openai";
if (process.env.NOVITA_API_KEY) return "novita";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Local selection retains Novita

When a user with an existing NOVITA_API_KEY reruns setup and selects Local, setup preserves that key and this branch continues selecting Novita, causing unexpected paid embedding requests instead of local inference.

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