File tree Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "$schema" : " https://raw.githubusercontent.com/github/context-server/main/schema.json" ,
3
+ "name" : " LLM Code Review Bot" ,
4
+ "description" : " A bot that uses LLMs to review pull request code diffs and post comments." ,
5
+ "app" : {
6
+ "name" : " llm-code-review-bot" ,
7
+ "version" : " 0.1.0"
8
+ },
9
+ "config" : {
10
+ "entrypoint" : " reviewbot.main:main" ,
11
+ "runtime" : {
12
+ "language" : " python"
13
+ }
14
+ },
15
+ "capabilities" : {
16
+ "pullRequestReview" : true
17
+ }
18
+ }
Original file line number Diff line number Diff line change 2
2
import requests
3
3
from reviewbot .utils import get_diff , post_pr_comment , get_pr_number
4
4
5
+ llm_prompt = "Please reviiew thsi code diff, list improvements and potential optimizations in bullet points" ;
6
+
5
7
def review_with_groq (diff ):
6
8
api_key = os .environ .get ("GROQ_API_KEY" )
7
9
headers = {
@@ -12,7 +14,7 @@ def review_with_groq(diff):
12
14
"model" : "meta-llama/llama-4-scout-17b-16e-instruct" ,
13
15
"messages" : [
14
16
{"role" : "system" , "content" : "You are a senior software engineer doing code reviews." },
15
- {"role" : "user" , "content" : f"Please review this code diff, list improvements in bullet points: \n \n { diff } " }
17
+ {"role" : "user" , "content" : f"{ llm_prompt } given the following diff{ diff } " }
16
18
],
17
19
"temperature" : 0.3 ,
18
20
}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def get_pr_number():
13
13
return event ["pull_request" ]["number" ]
14
14
15
15
def get_diff ():
16
- repo = os .environ .get ("GITHUB_REPOSITORY" ) # e.g. "owner/repo"
16
+ repo = os .environ .get ("GITHUB_REPOSITORY" )
17
17
pr_number = get_pr_number ()
18
18
19
19
token = os .environ .get ("GITHUB_TOKEN" )
Original file line number Diff line number Diff line change 1
1
# Hello.py: A sample python script used for testing reviews
2
2
3
- def helloWorld ():
4
- print ("Hello World" )
3
+ def twoSum (array , targetSum ):
4
+ for i in range (0 , len (array )):
5
+ for j in range (i + 1 , len (array )):
6
+ if array [i ] + array [j ] == targetSum :
7
+ return ([array [i ], array [j ]])
8
+ return []
5
9
6
- helloWorld ()
10
+ twoSum ([2 ,7 ,11 ,15 ], 9 )
11
+
You can’t perform that action at this time.
0 commit comments