Switch AI to OpenAI; drop Gemini /predict backend#10
Merged
Conversation
- Default the Vercel AI SDK provider to OpenAI (openai/gpt-4o-mini) via lib/ai/provider.ts getModel(); add @ai-sdk/openai direct-key path (OPENAI_API_KEY), keep AI Gateway + google/ fallback. Make the persona client and /api/gemini route provider-agnostic (no hardcoded Gemini ids). - Drop the Gemini-embedding /predict service entirely (it required a Gemini key and a model trained on Gemini embeddings): remove api.py, prediction_service.py, requirements_api.txt, Procfile, app/api/predict, and the orphaned app/sentiment-analyzer page. - Make services/ml_api (provider-free TF-IDF engine, /analyze) the deployed backend: repoint render.yaml and dev:ml to services.ml_api.main:app. - Update env.example and docs (README, RENDER_DEPLOY, API_README) accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
With the move off Gemini to an OpenAI key, switch the Next.js AI features to OpenAI and retire the Gemini-only embedding backend.
Next.js → OpenAI (gpt-4o-mini)
lib/ai/provider.tsgetModel()now defaults toopenai/gpt-4o-mini, with a direct-key path via@ai-sdk/openai(OPENAI_API_KEY). AI Gateway routing and thegoogle/direct-key fallback are retained — switching provider/model is still one env var (AI_MODEL).lib/google-ai/client.ts(persona critique/eval) andapp/api/gemini/route.tsmade provider-agnostic (no hardcoded Gemini model ids). Multimodal vision still works (gpt-4o-mini supports images).Drop the Gemini
/predictembedding backendIts XGBoost model was trained on 768-dim Gemini embeddings, so it can't run on OpenAI without retraining. Removed
api.py,prediction_service.py,requirements_api.txt,Procfile,app/api/predict/, and the orphanedapp/sentiment-analyzer/page (no references / not in nav).services/ml_apiis now the deployed backendThe provider-free TF-IDF recruiting engine (
/analyze, already proxied byapp/api/analyze) becomes the canonical backend. Repointedrender.yamlanddev:mltoservices.ml_api.main:app; updated env + docs.Verification
npx tsc --noEmit→ 0 errors.npm run lint→ 0 problems.services/ml_apiboots and loadsoutput/models(predictor loaded ✓).Notes
services/ml_api/requirements.txtis unpinned; its models were saved with scikit-learn 1.7.2. Pinningscikit-learnthere would avoid version-skew warnings (follow-up).services/ml_api.🤖 Generated with Claude Code