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 22import requests
33from reviewbot .utils import get_diff , post_pr_comment , get_pr_number
44
5+ llm_prompt = "Please reviiew thsi code diff, list improvements and potential optimizations in bullet points" ;
6+
57def review_with_groq (diff ):
68 api_key = os .environ .get ("GROQ_API_KEY" )
79 headers = {
@@ -12,7 +14,7 @@ def review_with_groq(diff):
1214 "model" : "meta-llama/llama-4-scout-17b-16e-instruct" ,
1315 "messages" : [
1416 {"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 } " }
1618 ],
1719 "temperature" : 0.3 ,
1820 }
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def get_pr_number():
1313 return event ["pull_request" ]["number" ]
1414
1515def get_diff ():
16- repo = os .environ .get ("GITHUB_REPOSITORY" ) # e.g. "owner/repo"
16+ repo = os .environ .get ("GITHUB_REPOSITORY" )
1717 pr_number = get_pr_number ()
1818
1919 token = os .environ .get ("GITHUB_TOKEN" )
Original file line number Diff line number Diff line change 11# Hello.py: A sample python script used for testing reviews
22
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 []
59
6- helloWorld ()
10+ twoSum ([2 ,7 ,11 ,15 ], 9 )
11+
You can’t perform that action at this time.
0 commit comments