Skip to content

feat(groqcloud): add audio transcription and translation actions - #256

Merged
l1shen merged 4 commits into
oomol-lab:mainfrom
rupaut98:feat/groqcloud-audio
Aug 3, 2026
Merged

feat(groqcloud): add audio transcription and translation actions#256
l1shen merged 4 commits into
oomol-lab:mainfrom
rupaut98:feat/groqcloud-audio

Conversation

@rupaut98

@rupaut98 rupaut98 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The groqcloud provider currently exposes chat completions and model listing only, so Groq's speech-to-text endpoints are unreachable — the provider has no proxy fallback either.

Action Endpoint
create_audio_transcription POST /audio/transcriptions
create_audio_translation POST /audio/translations

Audio is supplied inline as base64, or as a public URL that GroqCloud fetches itself through its native url field. Caller URLs are checked with assertPublicHttpUrl before being forwarded. The size cap applies to inline uploads; GroqCloud enforces its own limit on URLs it fetches.

Translation is restricted to whisper-large-v3. Requesting whisper-large-v3-turbo there returns The model 'whisper-large-v3-turbo' does not support 'translate', so the restriction is in the schema rather than surfacing as a runtime error.

Exercised against the live API with a real key: inline base64 upload, forwarded URL, verbose_json with word-level timestamp_granularities[], language/prompt/temperature passthrough, and both endpoints.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • New Features
    • Added GroqCloud audio transcription support.
    • Added GroqCloud audio translation support.
    • Audio can be provided through public URLs or base64-encoded content.
    • Added transcript options, including timestamps and structured output.
    • Added validation for supported models, audio sources, file sizes, formats, and timestamp settings.

Walkthrough

GroqCloud now exposes audio transcription and translation actions. The actions validate audio sources, supported models, transcript options, timestamps, and structured outputs. Executors accept public URLs or base64 audio, build multipart requests, enforce size and source constraints, and preserve JSON handling for existing requests. Tests cover request construction, validation failures, timestamp encoding, model differences, and filename requirements.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant GroqCloudExecutor
  participant GroqCloudAPI
  Client->>GroqCloudExecutor: submit transcription or translation input
  GroqCloudExecutor->>GroqCloudExecutor: validate audio and build multipart form
  GroqCloudExecutor->>GroqCloudAPI: POST audio request
  GroqCloudAPI-->>GroqCloudExecutor: return transcript payload
  GroqCloudExecutor-->>Client: return transcript payload
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required <type>(<scope>): <subject> format and clearly describes the added GroqCloud audio actions.
Description check ✅ Passed The description accurately explains the new transcription and translation actions, supported inputs, validation, model restrictions, and tested behavior.
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.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

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

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@src/providers/groqcloud/actions.ts`:
- Around line 135-149: Update audioFileSchema’s anyOf validation to enforce
exclusive audio sources: require url while rejecting content_base64 in the URL
branch, and require content_base64 plus name while rejecting url in the
inline-content branch. Keep the schema aligned with the executor’s existing
mutual-exclusion behavior.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dabc2e75-06fe-4230-8e90-2996c0ebf1f9

📥 Commits

Reviewing files that changed from the base of the PR and between 368eba8 and ed958d8.

📒 Files selected for processing (3)
  • src/providers/groqcloud/actions.ts
  • src/providers/groqcloud/executors.test.ts
  • src/providers/groqcloud/executors.ts

Comment thread src/providers/groqcloud/actions.ts
@l1shen
l1shen merged commit 36a1d4b into oomol-lab:main Aug 3, 2026
2 of 3 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/providers/groqcloud/executors.ts (1)

220-226: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Check file.content_base64 length before decoding.

base64Bytes decodes with Buffer.from(normalized, "base64") before validation, and the 25 MiB limit is only applied after decoding completes. Add an encoded-length check that includes the helper’s normalization and padding rules before base64Bytes, then keep the decoded-byte check for exact enforcement.

🤖 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/providers/groqcloud/executors.ts` around lines 220 - 226, Update the
attachment validation flow around base64Bytes to validate the normalized, padded
file.content_base64 encoded length against the 25 MiB limit before decoding,
matching base64Bytes’s normalization and padding rules. Preserve the existing
base64Bytes call and decoded bytes.byteLength check so the limit remains exactly
enforced after decoding.
🤖 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.

Outside diff comments:
In `@src/providers/groqcloud/executors.ts`:
- Around line 220-226: Update the attachment validation flow around base64Bytes
to validate the normalized, padded file.content_base64 encoded length against
the 25 MiB limit before decoding, matching base64Bytes’s normalization and
padding rules. Preserve the existing base64Bytes call and decoded
bytes.byteLength check so the limit remains exactly enforced after decoding.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 94bc44af-9914-4c72-9856-f3828a1cffc5

📥 Commits

Reviewing files that changed from the base of the PR and between 5e004f5 and e8be640.

📒 Files selected for processing (3)
  • src/providers/groqcloud/actions.ts
  • src/providers/groqcloud/executors.test.ts
  • src/providers/groqcloud/executors.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/providers/groqcloud/actions.ts

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.

2 participants