coderabbitai / ai-pr-reviewer

AI-based Pull Request Summarizer and Reviewer with Chat Capabilities.
https://coderabbit.ai
MIT License
1.41k stars 256 forks source link

Added support for Azure bot #519

Open PycKamil opened 4 months ago

PycKamil commented 4 months ago

What: Added langchain package that is used in AzureBot for communicating with Azure API. Based on provided configuration AzureBot will be used as Bot.

Why: This fixes issue #382. Enable to use coderabbitai with Azure API.

Summary by CodeRabbit

Summary by CodeRabbit

github-actions[bot] commented 4 months ago

Image description CodeRabbit

Walkthrough

This update introduces support for Azure bot using the langchain package, enhancing flexibility and maintainability. It includes new configurations for Azure API instance, deployment, and version. The code now uses the BotProtocol interface instead of the Bot class, allowing both AzureBot and Bot to be used interchangeably.

Changes

Files Summary
action.yml, package.json, tsconfig.json Added @langchain/openai package and updated dependencies. Introduced skipLibCheck option in TypeScript configuration.
src/azure-bot.ts, src/bot-interface.ts, src/bot.ts, src/main.ts, src/options.ts Implemented AzureBot class and BotProtocol interface. Modified run function to create AzureBot instances under certain conditions. Added new options for Azure API configuration.
src/review-comment.ts, src/review.ts Replaced Bot class with BotProtocol interface in import statements and function signatures. Updated handleReviewComment function to accept heavyBot parameter of type BotProtocol.

"With a hop and a skip, we've made quite the trip, πŸ‡πŸ’¨
From Bot to Protocol, oh what a spectacle! πŸ‘πŸŽ©
Azure's in sight, shining so bright, ☁️✨
Our code's taken flight, thanks to this update's might!" πŸš€πŸŒ™


Uplevel your code reviews with CodeRabbit Pro ### CodeRabbit Pro If you like this project, please support us by purchasing the [Pro version](https://coderabbit.ai). The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.
coderabbitaidev[bot] commented 4 months ago

[!WARNING]

CodeRabbit GitHub Action Detected

The repository is using both CodeRabbit Pro and CodeRabbit Open Source (via GitHub Actions), which is not recommended as it may lead to duplicate comments and extra noise. Please remove the CodeRabbit GitHub Action.

Walkthrough

The recent update introduces the AzureBot class, integrating Azure services with an OpenAI chat model, and refines the bot interaction framework by segregating interfaces to a new file and updating dependencies across the board. This revamp enhances flexibility in bot instantiation, especially with Azure deployments, and streamlines the bot communication protocol for improved interaction and response handling.

Changes

Files Change Summaries
src/azure-bot.ts Introduces AzureBot class for Azure/OpenAI chat model integration.
src/bot-interface.ts Adds interfaces for Ids and BotProtocol, including a chat method.
src/bot.ts, src/review*.ts Implements BotProtocol interface; references to Bot updated to BotProtocol.
src/main.ts, src/options.ts Adds Azure API configuration options and conditional AzureBot instantiation.

"In the digital meadow, under the cloud's gaze,
πŸ‡ A new bot hops forth, through the cybernetic maze.
Azure skies above, with OpenAI's might,
It chats, it learns, in the soft server light.
Code and bytes, in harmony blend,
A tale of updates, where innovation ascends."
🌟🌿πŸ–₯️🌿🌟


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 .` - `Generate unit-tests for this file.` - 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 tests 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 generate interesting stats about this repository from git and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit tests.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` 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 as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - 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/coderabbit-overrides.v2.json` ### CodeRabbit Discord Community Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.