-
Notifications
You must be signed in to change notification settings - Fork 675
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
feat: Add GitHub integration #559
Conversation
Important Review SkippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Thanks @rsrbk ! Seems we have some conflicts need to be solved, please do this when you have time |
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.
Thanks @rsrbk for your first contribution! It is amazing. Left some comments.
camel/functions/github_functions.py
Outdated
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.
Could we also add functions like list all the repos, issues, files and PRs? We can do it in the next PR.
382de58
to
4a7fdcb
Compare
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.
Thanks. I left some comments.
camel/functions/github_functions.py
Outdated
import os | ||
from typing import List | ||
|
||
from github import Auth, Github |
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.
We don’t want to make PyGithub
a mandatory dependency. Could we import it like how we do in other functions: https://github.com/camel-ai/camel/blob/master/camel/functions/search_functions.py. i.e. we import inside the functions.
camel/loaders/github_loader.py
Outdated
|
||
|
||
class GitHubLoaderIssue: | ||
def __init__(self, title, body, number, file_path, file_content): |
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.
Type hinting and docstrings are still missing. BTW, why not just use dataclass
: https://docs.python.org/3/library/dataclasses.html?
camel/loaders/github_loader.py
Outdated
def create_pull_request( | ||
self, file_path, new_content, pr_title, commit_message | ||
): | ||
branch_name = f"github-agent-update-{file_path.replace('/', '-')}" |
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.
This is still not fixed
camel/loaders/github_loader.py
Outdated
file = self.repo.get_contents(file_path) | ||
self.repo.update_file( | ||
file.path, commit_message, new_content, file.sha, branch=branch_name | ||
) |
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.
This is still not fixed
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.
thanks for the contribution, left some comments. I'm a little bit confused with the scope, will we set github as one agent or just make it as tool/function for agent to call?
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.
Looks amazing!!!
Description
The issue adds capability to build an agent that can solve specific issues in GitHub repos. It works by introducing a
GitHubLoader
which is a wrapper on top of PyGithub to do various operations with GitHub API like retrieving open issues or creating a pull request.The new set up functions introduced in
github_functions.py
allows agent to interact withGitHubLoader
and perform tasks specified by humans.Lastly, the new prompt template allows to easily construct the correct prompt that will fix a specific issue in a github repo and submits a PR with the fix.
Motivation and Context
Progressing on the CAMEL roadmap which involves building software engineering agents.
Types of changes
What types of changes does your code introduce? Put an
x
in all the boxes that apply:Implemented Tasks
Checklist
Go over all the following points, and put an
x
in all the boxes that apply.If you are unsure about any of these, don't hesitate to ask. We are here to help!