feat(forge): migrar motor LLM de Anthropic a Gemini - #24
Draft
turbillon50 wants to merge 2 commits into
Draft
Conversation
vForge ya no depende de Anthropic — todo el motor LLM ahora corre sobre
@google/genai (Gemini 2.5 Flash por default, gratis hasta cuota generosa).
Cambios:
- lib/forge/gemini-adapter.ts (nuevo): wrapper con conversion de tools
(input_schema -> functionDeclarations), mensajes (text/image -> parts,
tool_use/tool_result -> functionCall/functionResponse) y streaming
(eventos compatibles con frontend existente: text, tool_use_start,
tool_use_result, done).
- lib/forge/tools.ts: TOOLS ya no usa el tipo Tool de Anthropic, usa
NeutralTool del adapter.
- app/api/forge/run/route.ts: reescrito sobre GoogleGenAI con streamRound
helper. Mantiene el loop de hasta 5 rondas tool_use, parallel
executeTool, audit + persistencia conversations sin cambios.
- app/api/forge/recap/route.ts: usa gemini-2.5-flash (en vez de
claude-haiku-4-5).
- package.json: -@anthropic-ai/sdk +@google/genai.
- migrations/002_seed.sql: default_model = gemini-2.5-flash.
- estimateCost actualizado a pricing Gemini.
Pendiente del operador:
- Agregar GEMINI_API_KEY al vault (o env de Vercel) — el route.ts la lee
via getOperatorSecret("GEMINI_API_KEY").
- Update fila ai_config.default_model si hay deployment ya corriendo
(la migracion solo aplica a seeds nuevos).
extract-secret/route.ts no se tocó: ya usaba OpenAI gpt-4o vision, no
Anthropic.
|
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.
Resumen
vForge ya no depende de Anthropic — el motor LLM ahora corre sobre
@google/genai(Gemini 2.5 Flash por default, gratis hasta cuota generosa).Razón: Luis sin crédito en Anthropic. Gemini ofrece tier gratuito amplio para uso personal y la migración no requiere cambios en el frontend (eventos SSE preservados).
Cambios
lib/forge/gemini-adapter.ts(nuevo) — wrapper con conversión de tools (input_schema→functionDeclarations), mensajes (text/image→parts,tool_use/tool_result→functionCall/functionResponse) y streaming. Eventos SSE compatibles con frontend existente:text,tool_use_start,tool_use_result,done.lib/forge/tools.ts—TOOLSusaNeutralTooldel adapter (no másToolde Anthropic).app/api/forge/run/route.ts— reescrito sobreGoogleGenAIcon helperstreamRound. Mantiene loop de hasta 5 rondastool_use, parallelexecuteTool, audit + persistenciaconversations.app/api/forge/recap/route.ts— usagemini-2.5-flash(en vez declaude-haiku-4-5).package.json—-@anthropic-ai/sdk +@google/genai.migrations/002_seed.sql—default_model = 'gemini-2.5-flash'.estimateCost— pricing actualizado a Gemini.extract-secret/route.tsno se tocó: ya usaba OpenAI gpt-4o vision, no Anthropic.Test plan
GEMINI_API_KEYal vault (o env de Vercel)ai_config.default_model = 'gemini-2.5-flash'en BD si ya hay datos sembrados/forgechat: streaming texto visible, tools se invocan, persistencia OK/api/forge/recapcon sesión de 2+ turnosforge.chat.turnconmodel: gemini-2.5-flashGenerated by Claude Code