MCPcopy Create free account
hub / github.com/GitsSaikat/PyGen / main

Function main

pygen/code_reviewer.py:80–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

78 return "Failed to generate review."
79
80def main():
81 # Get user input for the package directory
82 package_dir = input("Enter the path to your generated Python package: ").strip()
83 if not os.path.isdir(package_dir):
84 print("Invalid package directory.")
85 return
86
87 # Load package files
88 package_files = load_package_files(package_dir)
89 if not package_files:
90 print("No valid files found in the package.")
91 return
92
93 # Get package name (assuming the package directory name is the package name)
94 package_name = os.path.basename(os.path.abspath(package_dir))
95
96 # Get Groq API key
97 api_key = os.environ.get("GROQ_API_KEY")
98 if not api_key:
99 api_key = input("Please enter your Groq API key: ").strip()
100 if not api_key:
101 print("Groq API key is required.")
102 return
103 os.environ["GROQ_API_KEY"] = api_key
104
105 # Initialize Groq client
106 client = Groq(api_key=api_key)
107
108 # Prompt the user for the model name
109 print("\nPlease enter the Groq model name you wish to use.")
110 print("Example model names: 'llama3-8b-8192', 'llama3-13b-8192', etc.")
111 model_name = input("Enter the Groq model name to use: ").strip()
112 while not model_name:
113 print("Model name cannot be empty. Please try again.")
114 model_name = input("Enter the Groq model name to use: ").strip()
115
116 # Generate the review
117 print("\nGenerating 100-word review...")
118 review = generate_review_with_groq(client, model_name, package_files, package_name)
119
120 print("\n=== Package Review ===")
121 print(review)
122 print("======================")
123
124if __name__ == "__main__":
125 main()

Callers 1

code_reviewer.pyFile · 0.70

Calls 2

load_package_filesFunction · 0.85

Tested by

no test coverage detected