Skip to content

Feat/ai-groq-summarize#837

Open
harshlocham wants to merge 2 commits into
TanStack:mainfrom
harshlocham:feat/ai-groq-summarize
Open

Feat/ai-groq-summarize#837
harshlocham wants to merge 2 commits into
TanStack:mainfrom
harshlocham:feat/ai-groq-summarize

Conversation

@harshlocham

@harshlocham harshlocham commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Replaced the command for the documentation verification script in package.json from node to tsx for improved execution. This change aligns with recent updates to enhance script performance and compatibility.

🎯 Changes

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • New Features

    • Added Groq summarization support, including new adapter factory helpers and related types.
    • Summarization is now available in the Groq docs, README, and API reference.
  • Bug Fixes

    • Improved summarization token handling so length limits are passed using the correct native option.
  • Tests

    • Added coverage for Groq summarization adapter creation, environment-based setup, and missing key handling.
    • Expanded end-to-end support for Groq summarization routes and feature detection.
  • Chores

    • Updated docs metadata and adjusted the docs verification command.

- Added `groqSummarize` and `createGroqSummarize` functions for summarization capabilities.
- Updated `package.json` to use `tsx` for running the documentation verification script.
- Enhanced documentation for the Groq adapter to include summarization examples and usage.
- Updated tests to validate the new summarization functionality and ensure proper integration with existing features.
- Modified configuration files to reflect the addition of summarization support.

This commit enhances the Groq integration by providing tree-shakeable summarization adapters, aligning with patterns used by other providers.
Replaced the command for the documentation verification script in package.json from `node` to `tsx` for improved execution. This change aligns with recent updates to enhance script performance and compatibility.
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds Groq summarize factories and exports for @tanstack/ai-groq, wires Groq into summarize tests and e2e routing, and updates docs, navigation metadata, and release notes.

Changes

Groq summarize support

Layer / File(s) Summary
Adapter types and factories
packages/ai-groq/src/adapters/summarize.ts, packages/ai-groq/src/index.ts
GroqSummarizeConfig and GroqSummarizeModel are added, along with createGroqSummarize and groqSummarize exports.
Adapter tests and wrapper behavior
packages/ai-groq/tests/groq-adapter.test.ts, packages/ai/tests/summarize-max-length.test.ts
Groq adapter creation tests and maxLength mapping tests are added for the summarize wrapper.
Summarize route wiring
testing/e2e/src/lib/feature-support.ts, testing/e2e/src/routes/api.summarize.ts
Groq is added to summarize and summarize-stream feature support and to the e2e route factory map.
Docs and release metadata
.changeset/groq-summarize-adapter.md, docs/adapters/groq.md, docs/config.json, package.json, packages/ai-groq/README.md
Groq summarize docs, README features, navigation metadata, docs verification, and the release note are updated.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Suggested reviewers

  • AlemTuzlak

Poem

A rabbit hopped through bytes and light,
and Groq began to summarize just right.
I nibbled docs and tested with glee,
then bounced through routes from A to Z.
Now carrots glow in the burrow’s glow.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The template is present, but the Changes section is effectively empty and the narrative focuses on package.json instead of the Groq summarization work. Describe the actual Groq summarize adapters, docs, tests, and changeset in the Changes section, and make the summary match the PR's main purpose.
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% 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 is a branch-style fragment rather than a clear sentence describing the Groq summarization feature. Rename it to a concise sentence like "Add Groq summarization adapters" so teammates can understand the main change at a glance.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@docs/config.json`:
- Around line 443-444: The Groq entry’s metadata is stale: update the updatedAt
value in docs/config.json for the affected entry from the older date to the
current docs change date. Use the existing entry fields around addedAt/updatedAt
to locate the record, and keep the updatedAt timestamp aligned with the content
change while leaving the rest of the metadata unchanged.

In `@testing/e2e/src/routes/api.summarize.ts`:
- Around line 50-54: The Groq e2e setup is overriding the adapter’s default
endpoint and missing the required /openai/v1 path, so requests are going to the
wrong route. Update the groq configuration in api.summarize.ts so
createGroqSummarize still uses llmockBase(aimockPort) but with the Groq-specific
/openai/v1 suffix, ensuring the adapter targets /openai/v1/chat/completions
instead of the root /chat/completions path.
🪄 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

Run ID: 93c8d147-485d-41d5-806c-278babe3ce70

📥 Commits

Reviewing files that changed from the base of the PR and between 037e15a and b8cea00.

📒 Files selected for processing (11)
  • .changeset/groq-summarize-adapter.md
  • docs/adapters/groq.md
  • docs/config.json
  • package.json
  • packages/ai-groq/README.md
  • packages/ai-groq/src/adapters/summarize.ts
  • packages/ai-groq/src/index.ts
  • packages/ai-groq/tests/groq-adapter.test.ts
  • packages/ai/tests/summarize-max-length.test.ts
  • testing/e2e/src/lib/feature-support.ts
  • testing/e2e/src/routes/api.summarize.ts

Comment thread docs/config.json
Comment on lines +443 to +444
"addedAt": "2026-04-15",
"updatedAt": "2026-06-18"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Refresh the Groq entry’s updatedAt.

2026-06-18 looks stale for this docs change; please bump it to 2026-06-25 so the navigation metadata stays accurate.

As per coding guidelines, docs/config.json entries must update updatedAt when making content changes.

🛠️ Suggested fix
-          "updatedAt": "2026-06-18"
+          "updatedAt": "2026-06-25"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"addedAt": "2026-04-15",
"updatedAt": "2026-06-18"
"addedAt": "2026-04-15",
"updatedAt": "2026-06-25"
🤖 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 `@docs/config.json` around lines 443 - 444, The Groq entry’s metadata is stale:
update the updatedAt value in docs/config.json for the affected entry from the
older date to the current docs change date. Use the existing entry fields around
addedAt/updatedAt to locate the record, and keep the updatedAt timestamp aligned
with the content change while leaving the rest of the metadata unchanged.

Source: Coding guidelines

Comment on lines +50 to +54
groq: () =>
createGroqSummarize('llama-3.3-70b-versatile', DUMMY_KEY, {
baseURL: llmockBase(aimockPort),
defaultHeaders: headers,
}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect how GroqTextAdapter builds its request URL from baseURL/config
fd -t f . packages/ai-groq/src -e ts | xargs rg -nC3 'baseURL|/v1|chat/completions|new URL|fetch\('
# Compare with grok adapter URL construction
fd -t f . packages/ai-grok/src -e ts | xargs rg -nC3 'baseURL|/v1|chat/completions'

Repository: TanStack/ai

Length of output: 20493


Ensure Groq e2e tests target the /openai/v1 endpoint path

The Groq adapter expects endpoints under /openai/v1, distinct from the standard /v1 used by OpenAI and Grok. The withGroqDefaults utility only injects the correct default if baseURL is absent; since the e2e test explicitly passes baseURL: llmockBase(aimockPort), the adapter uses that root path directly, resulting in requests to /chat/completions instead of the required /openai/v1/chat/completions.

Update the configuration to append the Groq-specific path:

// testing/e2e/src/routes/api.summarize.ts
groq: () =>
  createGroqSummarize('llama-3.3-70b-versatile', DUMMY_KEY, {
    baseURL: `${llmockBase(aimockPort)}/openai/v1`,
    defaultHeaders: headers,
  }),
🤖 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 `@testing/e2e/src/routes/api.summarize.ts` around lines 50 - 54, The Groq e2e
setup is overriding the adapter’s default endpoint and missing the required
/openai/v1 path, so requests are going to the wrong route. Update the groq
configuration in api.summarize.ts so createGroqSummarize still uses
llmockBase(aimockPort) but with the Groq-specific /openai/v1 suffix, ensuring
the adapter targets /openai/v1/chat/completions instead of the root
/chat/completions path.

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