Skip to content

Feature/groq gemini fallback#3

Merged
Soorya005 merged 2 commits into
mainfrom
feature/groq-gemini-fallback
May 8, 2026
Merged

Feature/groq gemini fallback#3
Soorya005 merged 2 commits into
mainfrom
feature/groq-gemini-fallback

Conversation

@Soorya005
Copy link
Copy Markdown
Owner

@Soorya005 Soorya005 commented May 8, 2026

Summary by CodeRabbit

  • New Features

    • Multi-provider LLM support: added Gemini and Groq as cloud fallback providers with automatic switching on failures.
    • Enhanced streaming response handling for real-time answer generation.
    • Improved fallback answer construction with better error messaging.
  • Bug Fixes

    • Better connectivity error handling for timeouts and connectivity issues.
  • Style

    • Redesigned UI layout with responsive sidebar and improved visual hierarchy.
    • Updated authentication flow to redirect to login page.
    • Refreshed component styling for file preview and repository explorer.

Soorya added 2 commits May 3, 2026 11:47
- Wire Gemini and Groq as first-class LLM providers in LLMClient
- Automatic fallback: Ollama → Gemini → Groq (no config needed)
- Detect Gemini quota/rate-limit errors and fall through to Groq
- Add GROQ_API_KEY, GROQ_MODEL, GEMINI_MODEL to RAGConfig + .env.example
- Pre-warm fallback clients on startup for zero-latency switching
- Fix duplicate groq import block in rag_pipeline.py
- Install groq + google-generativeai into venv
- Expand .gitignore to protect .env secrets and artifacts
- Sanitize .env.example (remove real API key, use placeholder)
@Soorya005 Soorya005 merged commit d4aa4db into main May 8, 2026
1 check was pending
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7892e882-96d8-470e-84ee-34102d4d062a

📥 Commits

Reviewing files that changed from the base of the PR and between 55728c5 and bb08023.

📒 Files selected for processing (14)
  • .gitignore
  • README.md
  • backend/.env.example
  • backend/README.md
  • backend/app/rag/gemini_client.py
  • backend/app/rag/rag_pipeline.py
  • backend/requirements.txt
  • backend/test_fallback.py
  • backend/verify_gemini.py
  • frontend/app/page.tsx
  • frontend/components/file-preview.tsx
  • frontend/components/repository-tree.tsx
  • frontend/lib/api.ts
  • frontend/tsconfig.tsbuildinfo

📝 Walkthrough

Walkthrough

This PR adds Gemini and Groq LLM providers with automatic fallback support to the RAG pipeline, enhances Ollama request handling with tighter timeouts and endpoint fallback, and redesigns the frontend layout into a responsive multi-pane structure with streaming response support.

Changes

Backend LLM Multi-Provider Integration

Layer / File(s) Summary
Configuration & Dependencies
.gitignore, README.md, backend/.env.example, backend/README.md, backend/requirements.txt
Expands .gitignore to exclude secrets and build artifacts; updates Ollama model references to qwen2.5-coder:1.5b-instruct-q4_K_M; lowers OLLAMA_REQUEST_TIMEOUT to 45; adds Gemini/Groq example keys and models; adds google-genai, groq, and gitpython dependencies.
Data Contracts
backend/app/rag/gemini_client.py, backend/app/rag/rag_pipeline.py
Introduces GeminiClient with API-key initialization and generate() method; extends RAGConfig with gemini_api_key, gemini_model, groq_api_key, and groq_model fields; detects availability of Gemini and Groq libraries.
Multi-Provider LLMClient
backend/app/rag/rag_pipeline.py
Extends LLMClient.__init__ to initialize providers for gemini and groq; pre-warms fallback clients when credentials and library support are available.
Generation with Fallback
backend/app/rag/rag_pipeline.py
Wraps generate() with try/except; routes failures through _generate_with_fallbacks performing Gemini→Groq cascade; adds Gemini quota/rate-limit detection; implements provider-specific dispatch for gemini and groq.
Ollama Enhancement
backend/app/rag/rag_pipeline.py
Tightens connection/read timeout budgeting; adds parameter retries; implements fallback from /api/generate to /api/chat on 404 responses.
Error Handling & Fallback Answers
backend/app/rag/rag_pipeline.py
Passes generation error context into _build_fallback_answer; differentiates connectivity-related failures (timeout/404); structures fallback answers for repository-summary queries with directory summaries and example files.
Testing & Verification
backend/test_fallback.py, backend/verify_gemini.py
Adds three test functions: direct Gemini API, Ollama fallback timeout trigger, and full fallback path; includes Gemini integration verification script with result validation.

Frontend Redesign with Streaming

Layer / File(s) Summary
API Streaming Support
frontend/lib/api.ts
apiQueryRepository now detects application/x-ndjson responses; reads and accumulates payload.delta into answer; returns early on payload.done === true with final answer/sources; falls back to JSON parsing for non-NDJSON responses.
Page Layout & Routing
frontend/app/page.tsx
Updates auth redirect to /login; replaces loading UI; restructures authenticated layout into responsive header + multi-pane flex layout (sidebar ChatSidebar, left RepositoryTree, center FilePreview, right AIExplanationPanel/QueryInput) with conditional rendering and adaptive breakpoints.
Component Styling
frontend/components/file-preview.tsx, frontend/components/repository-tree.tsx
Updates FilePreview to light card-based layout with FileCode2 icon, ScrollArea, and simplified truncation notice; updates RepositoryTree with flex column, ScrollArea, adjusted padding/indentation (8 + depth * 14), and selection-based text coloring.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 Whiskers twitching with delight,
Multiple providers now ignite,
Gemini, Groq in backup's hold,
Ollama falls back, brave and bold,
Frontend shines in panes so bright!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/groq-gemini-fallback

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Soorya005 added a commit that referenced this pull request May 8, 2026
Merge pull request #3 from Soorya005/feature/groq-gemini-fallback
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