import os import google.generativeai as generativeai from dotenv import load_dotenv # Load API key from environment load_dotenv() generativeai.configure(api_key=os.getenv("GOOGLE_GEMINI_KEY")) def get_correction_and_comments(code_snippet): prompt = [ "Analyze and correct the following Python code, add comments, and format it:", code_snippet ] response = generativeai.GenerativeModel('gemini-pro').generate_content(prompt) return response.text if response else "No suggestions available." def generate_questions(question): prompt = ["You are Python coding assistant generate only question and answer based of the given code" , question] response = generativeai.GenerativeModel('gemini-pro').generate_content(prompt) return response.text if response else "No answer available."