Skip to content

audio routes for groq and response_format for bedrock#1049

Merged
VisargD merged 2 commits into
Portkey-AI:mainfrom
narengogi:chore/groq-audio-routes
May 5, 2025
Merged

audio routes for groq and response_format for bedrock#1049
VisargD merged 2 commits into
Portkey-AI:mainfrom
narengogi:chore/groq-audio-routes

Conversation

@narengogi
Copy link
Copy Markdown
Member

@narengogi narengogi commented Apr 21, 2025

Code Quality new feature

Author Description

(optional)

  • Detailed change 1
  • Detailed change 2

Title: Audio routes for groq and response_format for bedrock

🔄 What Changed

  • Added support for audio-related API routes (transcription, translation, speech) in Groq provider
  • Added response_format parameter support for Bedrock provider
  • Implemented createSpeech parameters and response transformer in open-ai-base
  • Enhanced header handling for audio routes in Groq API configuration

🔍 Impact of the Change

  • Extends Groq provider with audio capabilities (transcription, translation, speech)
  • Adds response_format parameter support to Bedrock provider
  • Enhances the open-ai-base module with speech generation functionality
  • Improves API compatibility with audio-related features

📁 Total Files Changed

  • 5 files modified with 115 additions and 5 deletions

🧪 Test Added

N/A - No tests were added in this PR

🔒 Security Vulnerabilities

No security vulnerabilities detected

Quality Recommendations

  1. Add unit tests for the new audio routes and response_format functionality

  2. Consider adding validation for response_format values in the Bedrock implementation

  3. Add error handling for potential failures in audio processing routes

  4. Add documentation comments for the new createSpeechParams function

remove unused import

remove incorrect code
@narengogi narengogi force-pushed the chore/groq-audio-routes branch from 39aaa29 to 262ee6b Compare April 21, 2025 08:41
@narengogi narengogi requested review from VisargD and b4s36t4 April 21, 2025 08:49
@rahulbansal16
Copy link
Copy Markdown

When can we expect this PR to be merged?

@rahulbansal16
Copy link
Copy Markdown

@VisargD @b4s36t4 can you take a look.

@rahulbansal16
Copy link
Copy Markdown

@narengogi Any update on DPR?

@narengogi
Copy link
Copy Markdown
Member Author

hey @rahulbansal16 we'll get this merged and release today
cc: @VisargD

@VisargD VisargD merged commit 64f8dc3 into Portkey-AI:main May 5, 2025
1 check passed
@matterai-app
Copy link
Copy Markdown
Contributor

matterai-app Bot commented May 5, 2025

Code Quality new feature

Summary By MatterAI MatterAI logo

🔄 What Changed

  • Added support for response_format parameter in Bedrock provider
  • Added audio routes for Groq provider (transcriptions, translations, speech)
  • Implemented createSpeechParams and CreateSpeechResponseTransformer in open-ai-base
  • Updated headers configuration for audio routes in Groq provider

🔍 Impact of the Change

This PR enhances the gateway's capabilities by adding support for audio-related functionalities in the Groq provider and improving the Bedrock provider with response_format support. These changes allow clients to use audio transcription, translation, and speech generation with Groq, and have more control over response formatting with Bedrock.

📁 Total Files Changed

5 files changed with 115 additions and 5 deletions:

  • src/providers/bedrock/chatComplete.ts (+5, -0)
  • src/providers/bedrock/utils.ts (+3, -0)
  • src/providers/groq/api.ts (+15, -2)
  • src/providers/groq/index.ts (+10, -2)
  • src/providers/open-ai-base/index.ts (+82, -1)

🧪 Test Added

N/A - No tests were included in this PR.

🔒Security Vulnerabilities

N/A - No security vulnerabilities detected.

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Testing

Screenshots (if applicable)

N/A

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Related Issues

N/A

Sequence Diagram

sequenceDiagram
    participant Client
    participant Gateway
    participant Bedrock
    participant Groq
    
    Client->>Gateway: Request with response_format parameter
    alt Bedrock Provider
        Gateway->>Bedrock: transformAdditionalModelRequestFields(params)
        Note over Gateway,Bedrock: Add response_format to additionalModelRequestFields
        Bedrock-->>Gateway: Response with formatted output
    end
    
    alt Groq Provider
        Client->>Gateway: Audio API Request
        alt createTranscription
            Gateway->>Groq: POST /audio/transcriptions
            Note over Gateway,Groq: Content-Type: multipart/form-data
            Groq-->>Gateway: Transcription Response
        else createTranslation
            Gateway->>Groq: POST /audio/translations
            Note over Gateway,Groq: Content-Type: multipart/form-data
            Groq-->>Gateway: Translation Response
        else createSpeech
            Gateway->>Groq: POST /audio/speech
            Note over Gateway,Groq: Parameters: model, input, voice, response_format, speed
            Groq-->>Gateway: Speech Response
        end
    end
    
    Gateway-->>Client: Transformed Response
Loading

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.

3 participants