feat: groq api#465
Conversation
|
@madsysharma is attempting to deploy a commit to the aditthyass' projects Team on Vercel. A member of the Team first needs to authorize it. |
|
hey @madsysharma! 👋 |
|
Hi @AditthyaSS , please review this PR. Thanks. Also, please add the gssoc:approved label to it if everything is good to go. Thank you. |
|
|
|
@madsysharma I can see there are merge conflicts... |
|
Hi @AditthyaSS , have resolved the merge conflicts. Please check. |
|
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Note
|
| Layer / File(s) | Summary |
|---|---|
Provider model registry and JSDoc types src/lib/resolveAgentModel.js, src/lib/llmAdapter.js |
Groq models are registered in MODELS and MODEL_MAP for default selection; top-of-file docs and JSDoc unions for runAgent and streamAgent are updated to include 'groq'. |
Core Groq adapter implementation src/lib/llmAdapter.js |
PROVIDER_CONFIGS is extended with a groq entry that defines the OpenAI-compatible endpoint, request/response builders, and SSE streaming SSE chunk parsing logic. |
UI component integration src/components/ApiKeyBar.jsx, src/components/AgentRunner.jsx, src/components/KeyboardShortcutsModal.jsx |
Groq is added to provider selection with logo import, providerLogos/providerUrls mappings, keyboard shortcut Alt+4, display label mapping, and Groq-specific invalid API key error messaging. |
Battle mode provider support src/pages/BattleModeSetup.jsx |
Groq provider configuration is added to PROVIDERS array with display label, model id, and UI styling classes; other per-provider rendering remains unchanged. |
Agent registry hook integration src/pages/HomePage.jsx, src/pages/WorkflowBuilder.jsx, src/pages/WorkflowRunner.jsx |
useAgents hook is integrated in pages; HomePage memos now depend on agents; WorkflowBuilder seeds selectedAgents from preselected IDs once agents load; WorkflowRunner imports useAgents. |
Comprehensive Groq provider test suite tests/groq-provider.test.js |
Node.js test file validates model registry shape, model resolution fallback, one-shot request format and token counting, 401->invalid_api_key mapping, API key validation, and OpenAI-compatible SSE streaming with delta aggregation. |
Documentation and manifest updates CHANGELOG.md, README.md, package.json |
CHANGELOG documents Groq feature and shortcut; README adds Groq to provider list and supported models table; package.json adds a test script running node --test "tests/**/*.test.js". |
Sequence Diagram (high-level request flow):
sequenceDiagram
participant App
participant llmAdapter
participant GroqAPI
App->>llmAdapter: call runAgent/streamAgent(provider='groq', model, key)
llmAdapter->>GroqAPI: POST /openai/v1/chat/completions (Bearer key, JSON body)
GroqAPI-->>llmAdapter: HTTP response or SSE frames (delta.content / [DONE])
llmAdapter-->>App: parsed content, tokens, duration or error
Estimated code review effort:
🎯 3 (Moderate) | ⏱️ ~25 minutes
Suggested labels:
level:intermediate
Suggested reviewers:
- AditthyaSS
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. | |
| Title check | ❓ Inconclusive | The title 'feat: groq api' is vague and lacks specificity about what aspect of Groq API support is being added. | Consider a more descriptive title like 'feat: add Groq as LLM provider with OpenAI-compatible endpoint' to better convey the scope. |
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Linked Issues check | ✅ Passed | The PR comprehensively implements all coding requirements from issue #284: adds Groq provider selection in UI, leverages OpenAI-compatible endpoint for adapter, provides curated models with defaults, and maintains the existing architecture. |
| Out of Scope Changes check | ✅ Passed | All changes are in-scope for adding Groq provider support. The only noted out-of-scope item (Battle Mode changes) appears intentionally deferred per PR objectives. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
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.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
src/pages/WorkflowBuilder.jsx (1)
68-80:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winCritical:
setNodesandsetEdgesare undefined — runtime crash.Lines 70 and 74 call
setNodes()andsetEdges()but these state setters are never declared in this component. The component only hasselectedAgents,title,description, etc. as state variables.This appears to be code from a different node-based workflow editor that was incorrectly merged or copied here.
🐛 Proposed fix: Use existing state or remove dead code
If forking should populate the agent chain, use the existing
selectedAgentsstate:// Pre-populate from forked workflow useEffect(() => { - if (forkedWorkflow) { - setNodes( - JSON.parse(JSON.stringify(forkedWorkflow.nodes || [])) - ) - - setEdges( - JSON.parse(JSON.stringify(forkedWorkflow.edges || [])) - ) - - setTitle(`Copy of ${forkedWorkflow.title}`) - } + if (forkedWorkflow) { + // Resolve agent IDs to agent objects once registry loads + if (agents.length && forkedWorkflow.agents?.length) { + const loaded = forkedWorkflow.agents + .map((id) => agents.find((a) => a.id === id)) + .filter(Boolean) + setSelectedAgents(loaded) + } + setTitle(`Copy of ${forkedWorkflow.title}`) + setDescription(forkedWorkflow.description || '') + } + }, [forkedWorkflow, agents]) -}, [forkedWorkflow])🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/WorkflowBuilder.jsx` around lines 68 - 80, The effect references undefined setters setNodes and setEdges (causing the crash); replace that logic to populate the existing agent chain state instead or remove it: inside the useEffect that checks forkedWorkflow, call setSelectedAgents(JSON.parse(JSON.stringify(forkedWorkflow.agents || []))) to copy agents from forkedWorkflow (or map forkedWorkflow.nodes -> agents if agents are stored in nodes), keep the setTitle(`Copy of ${forkedWorkflow.title}`) line, and remove any setNodes/setEdges calls; ensure forkedWorkflow structure matches (agents vs nodes/edges) and adjust the mapping accordingly.src/pages/HomePage.jsx (1)
31-48:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winCritical: Missing import and duplicate declarations will cause runtime errors.
Multiple issues in this code segment:
useAgentsis called on line 31 but is never imported — this will throw aReferenceErrorat runtime.agentsis declared twice: fromuseAgents()(line 31) and fromuseState([])(line 33) — JavaScript will throw a syntax error for redeclaring aconst.allCategoriesis declared twice (lines 39-41 and lines 44-48) — another redeclaration error.This appears to be an incomplete refactor where both the old local-state approach and the new
useAgentshook exist simultaneously. Choose one approach and remove the other.🐛 Proposed fix: Use useAgents hook exclusively
Add the missing import at the top of the file:
import { useState, useMemo, useEffect } from 'react' import { useNavigate } from 'react-router-dom' +import { useAgents } from '../lib/useAgents'Then remove the duplicate declarations and legacy loading logic:
export default function HomePage() { const navigate = useNavigate() const { agents } = useAgents() const [searchQuery, setSearchQuery] = useState('') - const [agents, setAgents] = useState([]) - -useEffect(() => { - loadAllAgents().then(setAgents) -}, []) const [selectedCategory, setSelectedCategory] = useState(null) - const allCategories = useMemo(() => { - return [...new Set(agents.map((a) => a.category))].sort() - }, [agents]) useDocumentTitle() // Derive unique sorted categories from the loaded registry const allCategories = useMemo( () => [...new Set(agents.map((a) => a.category))].sort(), [agents] )Also remove the now-unused
loadAllAgentsimport if fully migrating to the hook.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/HomePage.jsx` around lines 31 - 48, Import the useAgents hook at the top of the file and migrate to using it exclusively: remove the local agents useState([]), the setAgents reference and the useEffect that calls loadAllAgents(), and remove the loadAllAgents import if no longer used; also delete the duplicate allCategories declaration so only the useMemo that derives categories from agents (from useAgents()) remains; ensure any references use the hook's agents value and keep useDocumentTitle as-is.src/pages/BattleModeSetup.jsx (2)
95-106:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winCritical: State initialization missing
groqentry.The
PROVIDERSarray now includesgroq(lines 60-72), but the initial state forresultsandpromptsonly includesopenai,anthropic, andgemini. This creates an inconsistency where:
- The
PROVIDERS.forEachloop at line 123 will iterate overgroqand attempt to updateresults.groqandprompts.groq- The rendering loop at line 376 will access
results[prov.id]forgroq, which will beundefinedinitially- During the initial render before the useEffect runs, the groq card will display with undefined state
This will cause runtime errors or unexpected behavior.
🔧 Proposed fix to include groq in state initialization
const [results, setResults] = useState({ openai: { loading: true, content: null, error: null, duration: null }, anthropic: { loading: true, content: null, error: null, duration: null }, gemini: { loading: true, content: null, error: null, duration: null }, + groq: { loading: true, content: null, error: null, duration: null }, }); const [promptViewerOpen, setPromptViewerOpen] = useState(false); const [prompts, setPrompts] = useState({ openai: null, anthropic: null, gemini: null, + groq: null, });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/BattleModeSetup.jsx` around lines 95 - 106, The initial state for results and prompts is missing an entry for the new provider "groq", causing undefined access when PROVIDERS.forEach updates results.groq and rendering reads results[prov.id]; update the useState initializers for results and prompts in BattleModeSetup (the const [results, setResults] = useState(...) and const [prompts, setPrompts] = useState(...)) to include a groq key mirroring the shape of the other providers (e.g., results.groq: { loading: true, content: null, error: null, duration: null } and prompts.groq: null) so PROVIDERS.forEach and the render loop can safely access results[prov.id] and prompts[prov.id].
214-372:⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftMajor: Prompt viewer hardcodes 3 providers, excludes Groq.
The Prompt Comparison Viewer (lines 230-372) hardcodes three separate columns for OpenAI, Claude, and Gemini, but doesn't include a column for Groq despite Groq being added to the
PROVIDERSarray. This means:
- When users run battle mode with Groq, they won't be able to view the Groq prompt in the comparison viewer
- The UI is inconsistent with the available providers
Either dynamically render columns based on the
PROVIDERSarray, or explicitly add a fourth column for Groq.📋 Recommended approach
Consider refactoring the prompt viewer to dynamically render columns based on
PROVIDERS:{promptViewerOpen && ( <div className="mt-4 battle-fade-in"> <div className="grid grid-cols-1 lg:grid-cols-3 xl:grid-cols-4 gap-6"> {PROVIDERS.map((prov) => ( <div key={prov.id} className="rounded-xl border border-gray-800 bg-gray-900/30 backdrop-blur-sm flex flex-col overflow-hidden"> <div className={`bg-gray-900/50 border-b border-gray-800 px-4 py-3 flex items-center justify-between`}> <span className={`text-sm font-bold ${prov.textColor}`}> {prov.label} </span> <button onClick={() => handleCopyPrompt(prov.id, prompts[prov.id])} className="flex items-center gap-1.5 px-2 py-1 rounded-md hover:bg-gray-800/50 transition-all duration-200" > {copiedProvider === prov.id ? ( <> <Check size={14} className="text-green-400" /> <span className="text-xs text-green-400">Copied</span> </> ) : ( <Copy size={14} className="text-gray-400 hover:text-gray-300" /> )} </button> </div> {/* Render system and user prompts */} </div> ))} </div> </div> )}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/BattleModeSetup.jsx` around lines 214 - 372, The Prompt Comparison Viewer currently hardcodes OpenAI/Claude/Gemini columns and omits Groq; update it to render provider columns dynamically from the PROVIDERS array (or add an explicit Groq column) so all providers (including "groq") appear. In practice, replace the three hardcoded blocks with a map over PROVIDERS (use provider.id, provider.label, provider.textColor) to produce each column, call handleCopyPrompt(provider.id, prompts[provider.id]) for the copy button, and use copiedProvider === provider.id to toggle the Check/Copy UI; also adjust the grid classes (e.g., lg:grid-cols-3 xl:grid-cols-4) to accommodate the extra column.
🧹 Nitpick comments (1)
src/lib/llmAdapter.js (1)
101-144: ⚡ Quick winConsider extracting a shared helper for OpenAI-compatible provider configs.
The
groqconfiguration is identical toopenai(and very similar toopenrouter) except for the endpoint URL. With three providers now sharing this OpenAI-compatible format, extracting a helper function would reduce duplication and improve maintainability. Bug fixes or improvements to the parsing logic would then apply consistently across all OpenAI-compatible providers.♻️ Example refactoring approach
+// Helper for OpenAI-compatible endpoints (OpenAI, OpenRouter, Groq, etc.) +function createOpenAICompatibleConfig(url, additionalHeaders = {}) { + return { + url, + buildHeaders: (apiKey) => ({ + 'Content-Type': 'application/json', + Authorization: `Bearer ${apiKey}`, + ...additionalHeaders, + }), + buildBody: (model, systemPrompt, userMessage) => ({ + model, + messages: [ + { role: 'system', content: systemPrompt }, + { role: 'user', content: userMessage }, + ], + max_tokens: 4096, + }), + buildStreamBody: (model, systemPrompt, userMessage) => ({ + model, + messages: [ + { role: 'system', content: systemPrompt }, + { role: 'user', content: userMessage }, + ], + max_tokens: 4096, + stream: true, + }), + parseResponse: (data) => ({ + content: data.choices?.[0]?.message?.content || '', + tokens: + (data.usage?.prompt_tokens || 0) + + (data.usage?.completion_tokens || 0), + }), + parseStreamChunk: (line) => { + if (line === 'data: [DONE]') return { content: '', done: true } + if (!line.startsWith('data: ')) return null + try { + const json = JSON.parse(line.slice(6)) + const delta = json.choices?.[0]?.delta?.content || '' + const finished = json.choices?.[0]?.finish_reason === 'stop' + return { content: delta, done: finished } + } catch { + return null + } + }, + } +} const PROVIDER_CONFIGS = { - openai: { - url: 'https://api.openai.com/v1/chat/completions', - buildHeaders: (apiKey) => ({ - 'Content-Type': 'application/json', - Authorization: `Bearer ${apiKey}`, - }), - // ... rest of config - }, + openai: createOpenAICompatibleConfig('https://api.openai.com/v1/chat/completions'), - openrouter: { - url: 'https://openrouter.ai/api/v1/chat/completions', - buildHeaders: (apiKey) => ({ - 'Content-Type': 'application/json', - Authorization: `Bearer ${apiKey}`, - 'HTTP-Referer': 'https://iloveagents.ai', - 'X-Title': 'ILoveAgents', - }), - // ... rest of config - }, + openrouter: createOpenAICompatibleConfig( + 'https://openrouter.ai/api/v1/chat/completions', + { + 'HTTP-Referer': 'https://iloveagents.ai', + 'X-Title': 'ILoveAgents', + } + ), - groq: { - url: 'https://api.groq.com/openai/v1/chat/completions', - buildHeaders: (apiKey) => ({ - 'Content-Type': 'application/json', - Authorization: `Bearer ${apiKey}`, - }), - // ... rest of config - }, + groq: createOpenAICompatibleConfig('https://api.groq.com/openai/v1/chat/completions'),🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/llmAdapter.js` around lines 101 - 144, Extract the duplicated OpenAI-compatible logic into a shared factory function (e.g., createOpenAICompatibleProvider or makeOpenAIProviderConfig) and replace the repeated groq keys (buildHeaders, buildBody, buildStreamBody, parseResponse, parseStreamChunk) with a call to that factory passing the provider-specific url ('https://api.groq.com/openai/v1/chat/completions'); ensure the factory returns the same shape (url, buildHeaders, buildBody, buildStreamBody, parseResponse, parseStreamChunk) so you can reuse it for openai and openrouter as well and consolidate parsing/token logic in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 15: The KeyboardShortcutsModal component is missing the Groq quick-switch
entry; update src/components/KeyboardShortcutsModal.jsx (the
KeyboardShortcutsModal component/JSX that renders the provider shortcut list) to
include the "Alt + 4" shortcut with the label "Groq" alongside the existing "Alt
+ 1 / 2 / 3" entries so the modal reflects the changelog; if the shortcuts are
generated from an array or constant (e.g., a shortcuts or providers list), add
the Groq item there and ensure the rendered UI displays "Alt + 4 — Groq" and
matches formatting of the other provider entries.
In `@README.md`:
- Line 78: Add an accessible alt attribute to the Groq logo image in the README
table row by updating the <img src="https://console.groq.com/groq-logo.svg"
width="80"/> element to include a descriptive alt (e.g., alt="Groq logo"); also
remove any incidental note about accessing the logo URL if present in the
surrounding text so the table simply displays the image with proper alt text in
the Groq row.
- Line 263: The README provider list is missing 'openrouter' compared to the
JSDoc/provider definitions used by the llmAdapter; update the example provider
enumeration where it shows provider: 'any' (the commented list "'openai' |
'anthropic' | 'gemini' | 'groq' | 'any'") to include 'openrouter' so it reads
"'openai' | 'anthropic' | 'gemini' | 'groq' | 'openrouter' | 'any'"; ensure the
README's agent config example text and any related examples reflect this added
provider string.
In `@src/lib/resolveAgentModel.js`:
- Around line 20-25: The groq model list in resolveAgentModel.js contains
invalid Groq IDs ('openai/gpt-oss-120b' and 'openai/gpt-oss-20b'); update the
groq array (the entries with value 'openai/gpt-oss-120b' and
'openai/gpt-oss-20b') to use valid Groq model identifiers or remove those
entries entirely, and adjust their label strings to match the new model names so
the groq array only contains supported Groq model values (keep the existing
valid entries 'llama-3.3-70b-versatile' and 'llama-3.1-8b-instant' unchanged).
In `@src/pages/WorkflowBuilder.jsx`:
- Around line 37-46: The effect at useEffect(...) that seeds selected agents
references an undefined preselected variable and will throw; update the effect
to read preselected from location.state.preselectedAgents (e.g., const
preselected = location?.state?.preselectedAgents) before using it, or remove
this effect entirely since the other useEffect that declares const preselected =
location.state.preselectedAgents already handles preselection; ensure you still
call setSelectedAgents((prev)=>...) only when a valid preselected array exists
and agents are available.
In `@src/pages/WorkflowRunner.jsx`:
- Line 85: The file calls useAgents() but never imports it and also redeclares
agents locally; import the useAgents hook at the top and remove the local agents
useState and its associated effect (remove the useState([]) that declares agents
and the effect that calls loadAllAgents), then rely solely on the agents
returned from useAgents(); also remove the loadAllAgents import if it becomes
unused. Ensure references to useAgents, agents (from hook), and any
loadAllAgents usage are updated accordingly.
---
Outside diff comments:
In `@src/pages/BattleModeSetup.jsx`:
- Around line 95-106: The initial state for results and prompts is missing an
entry for the new provider "groq", causing undefined access when
PROVIDERS.forEach updates results.groq and rendering reads results[prov.id];
update the useState initializers for results and prompts in BattleModeSetup (the
const [results, setResults] = useState(...) and const [prompts, setPrompts] =
useState(...)) to include a groq key mirroring the shape of the other providers
(e.g., results.groq: { loading: true, content: null, error: null, duration: null
} and prompts.groq: null) so PROVIDERS.forEach and the render loop can safely
access results[prov.id] and prompts[prov.id].
- Around line 214-372: The Prompt Comparison Viewer currently hardcodes
OpenAI/Claude/Gemini columns and omits Groq; update it to render provider
columns dynamically from the PROVIDERS array (or add an explicit Groq column) so
all providers (including "groq") appear. In practice, replace the three
hardcoded blocks with a map over PROVIDERS (use provider.id, provider.label,
provider.textColor) to produce each column, call handleCopyPrompt(provider.id,
prompts[provider.id]) for the copy button, and use copiedProvider ===
provider.id to toggle the Check/Copy UI; also adjust the grid classes (e.g.,
lg:grid-cols-3 xl:grid-cols-4) to accommodate the extra column.
In `@src/pages/HomePage.jsx`:
- Around line 31-48: Import the useAgents hook at the top of the file and
migrate to using it exclusively: remove the local agents useState([]), the
setAgents reference and the useEffect that calls loadAllAgents(), and remove the
loadAllAgents import if no longer used; also delete the duplicate allCategories
declaration so only the useMemo that derives categories from agents (from
useAgents()) remains; ensure any references use the hook's agents value and keep
useDocumentTitle as-is.
In `@src/pages/WorkflowBuilder.jsx`:
- Around line 68-80: The effect references undefined setters setNodes and
setEdges (causing the crash); replace that logic to populate the existing agent
chain state instead or remove it: inside the useEffect that checks
forkedWorkflow, call
setSelectedAgents(JSON.parse(JSON.stringify(forkedWorkflow.agents || []))) to
copy agents from forkedWorkflow (or map forkedWorkflow.nodes -> agents if agents
are stored in nodes), keep the setTitle(`Copy of ${forkedWorkflow.title}`) line,
and remove any setNodes/setEdges calls; ensure forkedWorkflow structure matches
(agents vs nodes/edges) and adjust the mapping accordingly.
---
Nitpick comments:
In `@src/lib/llmAdapter.js`:
- Around line 101-144: Extract the duplicated OpenAI-compatible logic into a
shared factory function (e.g., createOpenAICompatibleProvider or
makeOpenAIProviderConfig) and replace the repeated groq keys (buildHeaders,
buildBody, buildStreamBody, parseResponse, parseStreamChunk) with a call to that
factory passing the provider-specific url
('https://api.groq.com/openai/v1/chat/completions'); ensure the factory returns
the same shape (url, buildHeaders, buildBody, buildStreamBody, parseResponse,
parseStreamChunk) so you can reuse it for openai and openrouter as well and
consolidate parsing/token logic in one place.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ae2f569b-20e9-4047-bc58-a18fdeb2235c
⛔ Files ignored due to path filters (2)
package-lock.jsonis excluded by!**/package-lock.jsonsrc/assets/groq.svgis excluded by!**/*.svg
📒 Files selected for processing (12)
CHANGELOG.mdREADME.mdpackage.jsonsrc/components/AgentRunner.jsxsrc/components/ApiKeyBar.jsxsrc/lib/llmAdapter.jssrc/lib/resolveAgentModel.jssrc/pages/BattleModeSetup.jsxsrc/pages/HomePage.jsxsrc/pages/WorkflowBuilder.jsxsrc/pages/WorkflowRunner.jsxtests/groq-provider.test.js
11332c2 to
eed17c6
Compare
|
Hi @AditthyaSS , please review this updated PR. Thanks. |
1ae83b8 to
1aaae64
Compare
|
Hi @AditthyaSS , please review this updated PR. Thanks. |
1aaae64 to
72aca4b
Compare
|
Hi @AditthyaSS , please review this updated PR. Thanks. |
5e5a802 to
3623cdd
Compare
|
Hi @AditthyaSS , please review this updated PR. Thanks. |
|
|
|
|
|
Hi @AditthyaSS , I have resolved the merge conflicts. Please review this PR. Thank you. |
|
Hi @AditthyaSS , I have resolved the merge conflicts and synced the branch. Please review this PR. Thank you. |
|
|
|
Hi @AditthyaSS , I have resolved the merge conflicts. Please review this PR. Thank you. |
|
|
|
hey @madsysharma! 👋 |
|
Hi @AditthyaSS , I have resolved the merge conflicts and have ensured the branch is up to date. Please review this PR as it has been open for a while now. Thanks. |
77c771e to
02298c1
Compare
|
Hi @AditthyaSS , I have added package-lock.json as well. Please review this PR. Thanks. |
64ac785 to
275ac47
Compare
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
275ac47 to
4528dda
Compare
|
Hi @AditthyaSS , please review this PR. Thanks. |
|
|
|
|
feat: Groq API
Closes #284
Summary
Adds Groq as a runtime-selectable LLM provider alongside OpenAI, Anthropic and Gemini.
Groq exposes an OpenAI-compatible Chat Completions endpoint, so this slots cleanly into the existing unified adapter architecture with no new runtime dependencies and no backend changes: keys still go directly from the browser to the provider.
This makes the platform more accessible to students, beginners, and GSSoC contributors: Groq offers rapid LPU inference, a generous free tier and powerful open-weight models at little to no cost.
What changed
src/lib/llmAdapter.jsgroqentry inPROVIDER_CONFIGS: endpointhttps://api.groq.com/openai/v1/chat/completions, Bearer auth, OpenAI-shaped request/response, and SSE streaming. Supports bothrunAgent(one-shot) andstreamAgent(streaming). JSDoc provider unions updated.src/lib/resolveAgentModel.jsMODELS.groq(curated current production models) andMODEL_MAP.groqdefault (llama-3.3-70b-versatile).resolveAgentModelnow resolves and falls back correctly for Groq.src/components/ApiKeyBar.jsxPROVIDERS,providerLogos, andproviderUrls(key page:console.groq.com/keys); newAlt+4quick-switch shortcut.src/components/AgentRunner.jsxproviderLabels.groqlabel + a dedicated invalid-API-key error message for Groq.src/assets/groq.svgtests/groq-provider.test.jspackage.jsonnpm test->node --test "tests/**/*.test.js".README.md,CHANGELOG.mdUnreleasedentry.Models included
Curated to current Groq production models (the issue's suggested
mixtral-8x7b-32768has since been decommissioned on GroqCloud, so it was intentionally omitted):llama-3.3-70b-versatile: Llama 3.3 70B Versatile (default)llama-3.1-8b-instant: Llama 3.1 8B Instantopenai/gpt-oss-120b: GPT-OSS 120Bopenai/gpt-oss-20b: GPT-OSS 20BThese mirror the static, curated-list convention already used for OpenAI and Anthropic.
Design notes
openrouter/openaishape (system + user messages,max_tokens,stream,choices[].delta.contentSSE parsing,data: [DONE]terminator)..env, no backend. Consistent with the project's "bring your own key, runs in the browser" model.BattleModeArena/BattleModeSetupare a hard-coded 3-way comparison (OpenAI vs Anthropic vs Gemini) whose UI assumes exactly three color-coded columns. Adding a fourth provider there is a separate, larger change and isn't what this issue targets ("API Key / Provider Bar"). Happy to follow up in a dedicated PR if maintainers want it.Testing
Automated
Manual
npm run devAlt+4).Demo
Normal run:
Screen.Recording.2026-06-04.135124.-.Trim.mp4
Trying to run with invalid/expired API key:
Screen.Recording.2026-06-04.135252.mp4
Save for session:
Screen.Recording.2026-06-04.135440.mp4
Notes for reviewers
src/assets/groq.svgis an original mark in Groq's brand color (not a copy of Groq's proprietary logo artwork). If maintainers prefer the official brand SVG, it's a one-line swap.npm run buildstep currently fails onmaindue to a pre-existing, unrelated default-export mismatch betweensrc/agents/registry.js(exportsloadAllAgents) and components importingagentsas a default (e.g.Sidebar.jsx). That is not introduced by this PR and is left untouched. All files changed here transform cleanly through esbuild/Vite.Checklist
feature/groq-provider)Summary by CodeRabbit