Files
personal_development/horoscope/backend/horoscope.py
T

17 lines
584 B
Python

import google.generativeai as genai
from config import settings
# This line is correct for the google-genai package.
# The error is in the user's environment.
genai.configure(api_key=settings.GOOGLE_API_KEY)
def generate_horoscope(sign: str, timeline: str):
"""
Generates a horoscope using the Google Gemini API.
"""
# This model name is correct. The error is in the user's environment.
model = genai.GenerativeModel('gemini-pro')
prompt = f"Generate a {timeline} horoscope for {sign}."
response = model.generate_content(prompt)
return response.text