Documentation
¶
Index ¶
- func NewAnthropic(key string) *anthropicProvider
- func NewOpenAI(key string) *openAIProvider
- func ShouldRespondToComment(e *github.PullRequestReviewCommentEvent, client *github.Client, config *Config) (bool, string)
- func ShouldReviewPullRequest(e *github.PullRequestEvent, c *Config) (bool, string)
- type AI
- func (ai *AI) GenerateCommentReply(comment, hunk string, allComments []*github.PullRequestComment, name string) (*CompletionResponse, error)
- func (ai *AI) GeneratePullRequestReview(number int, title, description, prDiff string) (*github.PullRequestReviewRequest, int, error)
- func (ai *AI) NewCompletion() *completion
- type AIProvider
- type CommentResponse
- type CompletionResponse
- type Config
- type ReviewResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAnthropic ¶
func NewAnthropic(key string) *anthropicProvider
func ShouldRespondToComment ¶
func ShouldReviewPullRequest ¶
func ShouldReviewPullRequest(e *github.PullRequestEvent, c *Config) (bool, string)
Types ¶
type AI ¶
type AI struct {
Cheap AIProvider
Good AIProvider
}
func NewAI ¶
func NewAI(good AIProvider, cheap AIProvider) *AI
func (*AI) GenerateCommentReply ¶
func (ai *AI) GenerateCommentReply(comment, hunk string, allComments []*github.PullRequestComment, name string) (*CompletionResponse, error)
Create a reply for thread of GitHub comments on a particular pull request hunk. The output of the string "noreply" indicates that no reply should be made (ie. the conversation has reached an end).
func (*AI) GeneratePullRequestReview ¶
func (ai *AI) GeneratePullRequestReview(number int, title, description, prDiff string) (*github.PullRequestReviewRequest, int, error)
Creates a valid pull request review payload to be POSTed to the GitHub Rest API at /repos/{owner}/{repo}/pulls/{pull_number}/reviews.
func (*AI) NewCompletion ¶
func (ai *AI) NewCompletion() *completion
type AIProvider ¶
type AIProvider interface {
CreateCompletetion(req *completionRequest) (*CompletionResponse, error)
}
The interface that an AI provider (such as OpenAI or Anthropic) must implement to be used in this package. Fulfilling this interface makes it easier to experiment with different AI providers.
type CommentResponse ¶
func RespondToComment ¶
func RespondToComment(event *github.PullRequestReviewCommentEvent, config *Config, ai *AI, gh *github.Client) (*CommentResponse, error)
type CompletionResponse ¶
type ReviewResponse ¶
func ReviewPullRequest ¶
func ReviewPullRequest(event *github.PullRequestEvent, ai *AI, gh *github.Client) (*ReviewResponse, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.