Repository navigation
Add Gemini as LLM provider so proposal analysis works again - #5
Merged
Merged
Conversation
The Azure OpenAI resource (openai-04.openai.azure.com) no longer resolves, so every Analyze click returned a 500. Add a shared chat client that uses Google Gemini through its OpenAI-compatible endpoint when GEMINI_API_KEY is set and falls back to Azure OpenAI otherwise. - src/api/lib/llm.ts: provider selection, model, and extra params - analyze.ts / proposals.ts: use the shared client; analysis max_tokens 2000 -> 4000 - Gemini 2.5 thinks by default and those tokens count against max_tokens, which truncated the JSON reply; reasoning_effort none avoids it - .env.example: document GEMINI_API_KEY / GEMINI_MODEL
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
The Azure OpenAI resource (
openai-04.openai.azure.com) no longer resolves in DNS, so every Analyze click returned a 500. This adds Google Gemini as an alternative LLM provider so analysis and generation work again.src/api/lib/llm.ts: shared chat client. Uses Gemini via its OpenAI-compatible endpoint whenGEMINI_API_KEYis set, otherwise Azure OpenAI as before.analyze.tsandproposals.tsuse the shared client instead of constructing their ownAzureOpenAI..env.exampledocumentsGEMINI_API_KEY/GEMINI_MODEL(defaultgemini-2.5-flash).Things to know
max_tokens, which truncated the JSON reply (Unterminated string in JSON). Fixed withreasoning_effort: "none"and raising the analysismax_tokensfrom 2000 to 4000.GEMINI_API_KEYis unset.GEMINI_API_KEYin Render's environment to use this on the deployed app.Verification
npm run lint,npm run typecheck,npm test(55/55) pass.POST /api/analyze/:idagainst the "Website Update Proposal" sample on the local server: 200 in ~6s, readiness 30, 7 findings (35% discount over the 25% cap, $5,525 under the $10k minimum, Net 120 over the 90-day limit), 5 recommendations.