Spaces:
Sleeping
Sleeping
| import os | |
| from groq import Groq | |
| def generate(prompt: str, max_tokens: int = 800) -> str: | |
| client = Groq(api_key=os.environ["GROQ_API_KEY"]) | |
| response = client.chat.completions.create( | |
| model="llama-3.1-8b-instant", | |
| messages=[ | |
| {"role": "system", "content": "You are an HOA document analyst. Respond with valid JSON only. No text outside the JSON object."}, | |
| {"role": "user", "content": prompt} | |
| ], | |
| max_tokens=max_tokens, | |
| temperature=0.1, | |
| ) | |
| return response.choices[0].message.content | |