-
Notifications
You must be signed in to change notification settings - Fork 68
SD2-1327-ll-ms-make-it-possible-to-generate-audio-files #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SD2-1327-ll-ms-make-it-possible-to-generate-audio-files #344
Conversation
WalkthroughThe changes update several API classes by adding two new optional parameters, Changes
Sequence Diagram(s)sequenceDiagram
participant U as User Request
participant API as API Class (e.g. AmazonLLMApi)
participant LC as LLM Client
U->>API: Call llm__chat(..., modalities, audio)
API->>LC: Invoke completion(..., modalities, audio)
LC-->>API: Return completion result
API-->>U: Return chat response
sequenceDiagram
participant U as User Request
participant LE as LLMEngine.completion
participant LC as LLM Client
U->>LE: Call completion(..., modalities, audio)
LE->>LE: Add modalities & audio to parameters (if provided)
LE->>LC: Call completion with updated parameters
LC-->>LE: Return completion result
LE->>U: Return result (or handle ValueError)
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
edenai_apis/features/llm/llm_interface.py (1)
30-31
: LGTM: New parameters for audio capabilities added to the interfaceThe addition of
modalities
andaudio
parameters aligns well with the PR objective of enabling audio file generation. The typing is appropriately defined withmodalities
restricted to specific literal values.However, it would be beneficial to update the method docstring (lines 56-73) to include descriptions for these new parameters to improve developer understanding.
edenai_apis/llmengine/llm_engine.py (1)
746-747
: Consider standardizing the audio parameter type across API classes.There's a type inconsistency between API classes (which use
Optional[Dict]
) andLLMEngine
(which usesOptional[ChatCompletionAudioParam]
). While this might not cause runtime issues if the dictionary structure matches the expected format, standardizing the type would improve type safety.For consistency, consider either:
- Using
ChatCompletionAudioParam
in all API classes- Adding documentation to clarify the expected dictionary structure in the API classes
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
edenai_apis/apis/amazon/amazon_llm_api.py
(3 hunks)edenai_apis/apis/anthropic/anthropic_api.py
(2 hunks)edenai_apis/apis/cohere/cohere_api.py
(2 hunks)edenai_apis/apis/deepseek/deepseek_api.py
(2 hunks)edenai_apis/apis/google/google_llm_api.py
(3 hunks)edenai_apis/apis/groq/groq_api.py
(2 hunks)edenai_apis/apis/meta/meta_api.py
(2 hunks)edenai_apis/apis/microsoft/microsoft_llm_api.py
(3 hunks)edenai_apis/apis/mistral/mistral_api.py
(2 hunks)edenai_apis/apis/openai/openai_llm_api.py
(3 hunks)edenai_apis/apis/replicate/replicate_api.py
(2 hunks)edenai_apis/apis/together_ai/together_ai_api.py
(2 hunks)edenai_apis/apis/xai/xai_llm_api.py
(3 hunks)edenai_apis/features/llm/llm_interface.py
(2 hunks)edenai_apis/llmengine/llm_engine.py
(4 hunks)
🔇 Additional comments (26)
edenai_apis/apis/cohere/cohere_api.py (1)
349-350
: LGTM: New audio-related parameters properly implementedThe parameters added to the method signature match those in the interface and are correctly passed to the underlying
llm_client.completion
method. Implementation maintains consistency with the interface design.Also applies to: 407-408
edenai_apis/apis/google/google_llm_api.py (1)
28-29
: LGTM: Audio parameters correctly implementedThe new parameters match the interface definition and are properly passed to the completion method. Implementation is consistent with the other API classes being updated.
Also applies to: 86-87
edenai_apis/apis/amazon/amazon_llm_api.py (1)
28-29
: LGTM: Audio capability parameters added consistentlyThe implementation follows the same pattern as the other API classes, maintaining consistency across the codebase. The parameters are properly defined and passed to the underlying completion method.
Also applies to: 86-87
edenai_apis/apis/microsoft/microsoft_llm_api.py (3)
1-1
: Import modifications are properly handled.The import statement has been updated to include
Literal
andDict
which are required for the new parameters.
27-28
: LGTM! Parameter additions for audio support.The new parameters
modalities
andaudio
have been properly defined with appropriate type hints and default values.
85-87
: Parameters correctly passed to the completion method.The newly added parameters are properly passed to the underlying
llm_client.completion
method.edenai_apis/apis/groq/groq_api.py (2)
77-78
: LGTM! Parameter additions for audio support.The new parameters
modalities
andaudio
have been properly defined with appropriate type hints and default values.
135-137
: Parameters correctly passed to the completion method.The newly added parameters are properly passed to the underlying
llm_client.completion
method.edenai_apis/apis/deepseek/deepseek_api.py (2)
76-77
: LGTM! Parameter additions for audio support.The new parameters
modalities
andaudio
have been properly defined with appropriate type hints and default values.
134-136
: Parameters correctly passed to the completion method.The newly added parameters are properly passed to the underlying
llm_client.completion
method.edenai_apis/apis/together_ai/together_ai_api.py (2)
80-81
: LGTM! Parameter additions for audio support.The new parameters
modalities
andaudio
have been properly defined with appropriate type hints and default values.
138-140
: Parameters correctly passed to the completion method.The newly added parameters are properly passed to the underlying
llm_client.completion
method.edenai_apis/apis/replicate/replicate_api.py (1)
261-262
: Appropriate implementation for multimodal support.The addition of
modalities
andaudio
parameters enables audio generation capabilities. The parameters are properly typed and aligned with the PR objective to support audio file generation.Also applies to: 319-320
edenai_apis/apis/anthropic/anthropic_api.py (1)
150-151
: Implementation follows API pattern consistently.The addition of
modalities
andaudio
parameters correctly extends the API to support audio generation. The parameters are properly typed and consistently passed to the underlying completion method.Also applies to: 208-209
edenai_apis/apis/mistral/mistral_api.py (1)
184-185
: Clean implementation of multimodal support.The addition of
modalities
andaudio
parameters to the Mistral API follows the same pattern as other provider implementations, ensuring consistency across the codebase.Also applies to: 242-243
edenai_apis/apis/openai/openai_llm_api.py (2)
1-1
: Type import correctly updated.The
Literal
import has been appropriately added to support the new parameter typing.
27-28
: Audio generation implementation properly added.The OpenAI LLM API implementation correctly adds support for audio generation with the new parameters. The implementation is consistent with other API classes in the system.
Also applies to: 84-85
edenai_apis/apis/meta/meta_api.py (2)
143-144
: Implementation of multimodal support with audio parameter looks correct.The added parameters
modalities
andaudio
extend the method to support multimodal chat capabilities, specifically for audio inputs.
201-202
: Properly passing new parameters to the completion method.The new parameters are correctly passed to the underlying
llm_client.completion
method.edenai_apis/apis/xai/xai_llm_api.py (3)
1-1
: Updated imports to support new parameter types.The import statement has been correctly updated to include
Literal
andDict
from thetyping
module, which are necessary for the type annotations of the new parameters.
28-29
: Added multimodal support parameters with appropriate type hints.The implementation correctly adds the
modalities
andaudio
parameters with proper type annotations.
86-87
: Properly passing new parameters to the completion method.New parameters are correctly passed to the underlying completion method.
edenai_apis/llmengine/llm_engine.py (4)
12-12
: Added proper import for audio parameter type.The import for
ChatCompletionAudioParam
is correctly added, providing a specific type for the audio parameter.
114-116
: Improved error message formatting.The error message has been reformatted for better readability while maintaining the same error handling logic.
746-747
: Implemented core parameters for multimodal support.The
modalities
andaudio
parameters are correctly added to the method signature, allowing for multimodal capabilities.
784-787
: Properly handling new parameters in request preparation.The code correctly checks if the parameters are provided and adds them to the completion parameters dictionary only when they're not None.
Summary by CodeRabbit