-
Notifications
You must be signed in to change notification settings - Fork 68
Microsoft LLM feature #343
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
Conversation
WalkthroughThis pull request introduces a new language model integration for the Microsoft API. A new "llm" section is added to the JSON configuration, containing a "chat" object with a specified version. In the Python modules, the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant MSApi as MicrosoftApi
participant MSLLM as MicrosoftLLMApi
participant LLMClient
Client->>MSApi: Initiate chat request
MSApi->>MSLLM: Call llm__chat() method
MSLLM->>LLMClient: Forward parameters via llm_client.completion
LLMClient-->>MSLLM: Return chat response
MSLLM->>Client: Respond with ChatDataClass instance
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: 1
🧹 Nitpick comments (1)
edenai_apis/apis/microsoft/microsoft_llm_api.py (1)
9-85
: Consider adding docstrings and basic error handling
Thellm__chat
method could benefit from a docstring explaining parameters and expected outputs. Additionally, wrapping theself.llm_client.completion(...)
call in a try/except block can help gracefully handle potential exceptions.🧰 Tools
🪛 Ruff (0.8.2)
12-12: Do not use mutable data structures for argument defaults
Replace with
None
; initialize within function(B006)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
edenai_apis/apis/microsoft/info.json
(1 hunks)edenai_apis/apis/microsoft/microsoft_api.py
(2 hunks)edenai_apis/apis/microsoft/microsoft_llm_api.py
(1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
edenai_apis/apis/microsoft/microsoft_api.py (1)
edenai_apis/apis/microsoft/microsoft_llm_api.py (1)
MicrosoftLLMApi
(9-85)
🪛 Ruff (0.8.2)
edenai_apis/apis/microsoft/microsoft_llm_api.py
12-12: Do not use mutable data structures for argument defaults
Replace with None
; initialize within function
(B006)
🔇 Additional comments (3)
edenai_apis/apis/microsoft/info.json (1)
1764-1768
: Addition of the LLM section looks consistent
The newly introduced"llm"
section aligns with the existing structure and provides a clear categorization for chat capabilities. Good job!edenai_apis/apis/microsoft/microsoft_api.py (2)
13-13
: ImportingMicrosoftLLMApi
No concerns here. This import seamlessly integrates the newly introducedMicrosoftLLMApi
into theMicrosoftApi
class.
28-28
: Adoption ofMicrosoftLLMApi
in class inheritance
By inheriting fromMicrosoftLLMApi
,MicrosoftApi
now benefits from chat-related functionalities without duplicating code. Implementation looks straightforward.
class MicrosoftLLMApi(LlmInterface): | ||
def llm__chat( | ||
self, | ||
messages: List = [], |
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.
Avoid using a mutable list as the default argument
Using messages: List = []
as a default can cause unintended behavior due to Python’s handling of mutable default arguments.
Please consider the following fix:
- messages: List = []
+ messages: Optional[List] = None
if messages is None:
messages = []
🧰 Tools
🪛 Ruff (0.8.2)
12-12: Do not use mutable data structures for argument defaults
Replace with None
; initialize within function
(B006)
Summary by CodeRabbit