Spaces:
Sleeping
Sleeping
from groq import Groq | |
from config import GROQ_API_KEY, MODEL_NAME | |
# Initialize Groq client | |
client = Groq(api_key=GROQ_API_KEY) | |
def generate_response(user_input): | |
try: | |
response = client.chat.completions.create( | |
messages=[{"role": "user", "content": user_input}], | |
model=MODEL_NAME, | |
) | |
return response.choices[0].message.content | |
except Exception as e: | |
return f"Error: {e}" | |