Spaces:
Sleeping
Sleeping
File size: 435 Bytes
07d1593 c60864a 07d1593 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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}"
|