gateway icon indicating copy to clipboard operation
gateway copied to clipboard

audio routes for groq and response_format for bedrock

Open narengogi opened this issue 7 months ago β€’ 4 comments

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

narengogi avatar Apr 21 '25 08:04 narengogi

When can we expect this PR to be merged?

rahulbansal16 avatar Apr 23 '25 09:04 rahulbansal16

@VisargD @b4s36t4 can you take a look.

rahulbansal16 avatar Apr 25 '25 18:04 rahulbansal16

@narengogi Any update on DPR?

rahulbansal16 avatar Apr 30 '25 06:04 rahulbansal16

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

narengogi avatar Apr 30 '25 08:04 narengogi

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

  • [x] 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
  • [x] Manual Testing

Screenshots (if applicable)

N/A

Checklist

  • [x] My code follows the style guidelines of this project
  • [x] 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
  • [x] 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

matter-code-review[bot] avatar May 05 '25 03:05 matter-code-review[bot]