Skip to content

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

Merged
merged 1 commit into from
Mar 26, 2025
Merged

Conversation

Daggx
Copy link
Contributor

@Daggx Daggx commented Mar 26, 2025

Summary by CodeRabbit

  • New Features
    • Introduced enhanced chat functionality powered by Azure AI Foundry, enabling dynamic conversational interactions.
    • Expanded customization options for chat operations, delivering a more versatile and robust user experience.

Copy link

coderabbitai bot commented Mar 26, 2025

Walkthrough

This 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 MicrosoftApi class is updated to inherit from a newly introduced MicrosoftLLMApi class. Additionally, a new file defines the MicrosoftLLMApi class, which implements a comprehensive llm__chat method to handle chat requests with various customization options.

Changes

File(s) Change Summary
edenai_apis/.../info.json Added a new "llm" section containing a "chat" object with "version": "Azure AI Foundry" placed before the _metadata section.
edenai_apis/.../microsoft_api.py
edenai_apis/.../microsoft_llm_api.py
Updated MicrosoftApi to inherit from MicrosoftLLMApi (with an added import) and introduced a new MicrosoftLLMApi class implementing LlmInterface with a detailed llm__chat method.

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
Loading

Possibly related PRs

  • Azure AI Foundry LLMs #326: Introduced a similar "chat" object in the JSON file, focusing on chat capabilities within the Azure AI Foundry context.

Suggested reviewers

  • juandavidcruzgomez

Poem

I’m a playful rabbit in the code field,
Hopping on bytes and features revealed.
With chat and LLM now interwove,
I celebrate code with a joyful trove.
May our paths be light and our logic bright! 🐰
Hop on, dear coder – the changes take flight!

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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
The llm__chat method could benefit from a docstring explaining parameters and expected outputs. Additionally, wrapping the self.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

📥 Commits

Reviewing files that changed from the base of the PR and between d4bead9 and 9f76b25.

📒 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: Importing MicrosoftLLMApi
No concerns here. This import seamlessly integrates the newly introduced MicrosoftLLMApi into the MicrosoftApi class.


28-28: Adoption of MicrosoftLLMApi in class inheritance
By inheriting from MicrosoftLLMApi, MicrosoftApi now benefits from chat-related functionalities without duplicating code. Implementation looks straightforward.

class MicrosoftLLMApi(LlmInterface):
def llm__chat(
self,
messages: List = [],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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)

@juandavidcruzgomez juandavidcruzgomez merged commit 8b2bc24 into master Mar 26, 2025
4 of 5 checks passed
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.

2 participants