import google.generativeai as genai import os from dotenv import load_dotenv # Load environment variables load_dotenv() #Google Gemini genai.configure(api_key=os.environ["GOOGLE_API_KEY"]) # Initialize the generative model model = genai.GenerativeModel("gemini-pro") def modelFeedback(ats_score, resume_data): # Create the input prompt to generate resume and ATS input_prompt = f""" Your task is to provide summary (up to 100 words) based on the resume and analysis (20 words). """ # Combine the prompt and resume data for input to the model input_data = [input_prompt, resume_data] try: # Generate content using the AI model response = model.generate_content(input_data, stream=True) # Wait for the response to resolve if streaming response.resolve() # Assuming the response contains the generated content in text format return response.text.strip() except Exception as e: # Handle any potential errors that occur during API call print(f"Error: {str(e)}") return "Error. Please try again."