review.bot.open_ai_interface
#
Functions to interface with OpenAI.
Module Contents#
Functions#
|
Review a patch in a pull request and generate suggestions for improvement. |
|
Review a patch in a pull request and generate suggestions for improvement. |
|
Generate suggestions for a given file source and patch. |
|
Generate suggestions for a given file source and patch. |
Attributes#
- review.bot.open_ai_interface.LOG#
- review.bot.open_ai_interface.OPEN_AI_MODEL#
- review.bot.open_ai_interface.review_patch(owner, repo, pr, use_src=False, filter_filename=None, gh_access_token=None, config_file: str = None)#
Review a patch in a pull request and generate suggestions for improvement.
- Parameters:
- owner
str
The GitHub owner/organization of the repository.
- repo
str
The name of the repository on GitHub.
- pr
str
The pull request number.
- use_srcbool, default:
False
Use the source file as context for the patch. Works for small files and not for large ones.
- filter_filename
str
,optional
If set, filters out all but the file matching this string.
- gh_access_token
str
,optional
GitHub token needed to communicate with the repository. By default,
None
, which means it will try to read an existing env variable namedGITHUB_TOKEN
.- config_file
str
,optional
Path to OpenAI configuration file. By default,
None
.- Returns
- ——-
- list[dict]
A dictionary containing suggestions for the reviewed patch.
- owner
- review.bot.open_ai_interface.review_patch_local(repo: str, branch: str = None, use_src=False, filter_filename=None, config_file: str = None)#
Review a patch in a pull request and generate suggestions for improvement.
- Parameters:
- repo
str
The path to the local repository.
- branch
str
Name of the branch you want to compare to main. By default, current branch.
- use_srcbool, default:
False
Use the source file as context for the patch. Works for small files and not for large ones.
- filter_filename
str
,optional
If set, filters out all but the file matching this string.
- config_file
str
,optional
Path to OpenAI configuration file. By default,
None
.
- repo
- Returns:
- review.bot.open_ai_interface.generate_suggestions_with_source(filename, file_src, patch, config_file: str = None) List[Dict[str, str]] #
Generate suggestions for a given file source and patch.
- Parameters:
- Returns: