Skip to content

Switch AI to OpenAI; drop Gemini /predict backend#10

Merged
f1shyfang merged 1 commit into
mainfrom
refactor/openai-and-drop-embedding-backend
May 30, 2026
Merged

Switch AI to OpenAI; drop Gemini /predict backend#10
f1shyfang merged 1 commit into
mainfrom
refactor/openai-and-drop-embedding-backend

Conversation

@f1shyfang
Copy link
Copy Markdown
Owner

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.ts getModel() now defaults to openai/gpt-4o-mini, with a direct-key path via @ai-sdk/openai (OPENAI_API_KEY). AI Gateway routing and the google/ direct-key fallback are retained — switching provider/model is still one env var (AI_MODEL).
  • lib/google-ai/client.ts (persona critique/eval) and app/api/gemini/route.ts made provider-agnostic (no hardcoded Gemini model ids). Multimodal vision still works (gpt-4o-mini supports images).

Drop the Gemini /predict embedding backend

Its 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 orphaned app/sentiment-analyzer/ page (no references / not in nav).

services/ml_api is now the deployed backend

The provider-free TF-IDF recruiting engine (/analyze, already proxied by app/api/analyze) becomes the canonical backend. Repointed render.yaml and dev:ml to services.ml_api.main:app; updated env + docs.

Verification

  • npx tsc --noEmit → 0 errors.
  • npm run lint → 0 problems.
  • services/ml_api boots and loads output/models (predictor loaded ✓).

Notes

  • services/ml_api/requirements.txt is unpinned; its models were saved with scikit-learn 1.7.2. Pinning scikit-learn there would avoid version-skew warnings (follow-up).
  • The README's upper half still describes the original notebook training workflow (research history); left intact with a pointer note that the runtime backend is now services/ml_api.

🤖 Generated with Claude Code

- 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>
Copilot AI review requested due to automatic review settings May 30, 2026 09:50
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lyra-hackathon Ready Ready Preview, Comment May 30, 2026 9:51am

@f1shyfang f1shyfang merged commit c96f72d into main May 30, 2026
1 of 3 checks passed
@f1shyfang f1shyfang deleted the refactor/openai-and-drop-embedding-backend branch May 30, 2026 09:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants