gateway
gateway copied to clipboard
audio routes for groq and response_format for bedrock
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
-
Add unit tests for the new audio routes and response_format functionality
-
Consider adding validation for response_format values in the Bedrock implementation
-
Add error handling for potential failures in audio processing routes
-
Add documentation comments for the new createSpeechParams function
When can we expect this PR to be merged?
@VisargD @b4s36t4 can you take a look.
@narengogi Any update on DPR?
hey @rahulbansal16 we'll get this merged and release today cc: @VisargD
Summary By MatterAI 
π 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