import os from groq import Groq from dotenv import load_dotenv from root_tools import gather_research load_dotenv() client = Groq(api_key=os.getenv("GROQ_API_KEY")) def generate_report(topic): raw_content, sources = gather_research(topic) # unpack both now response = client.chat.completions.create( model="llama-3.3-70b-versatile", messages=[ { "role": "system", "content": "You are an expert research analyst. Write clear structured reports." }, { "role": "user", "content": f"Using this research data, write a detailed structured report on: {topic}\n\nData:\n{raw_content}" } ] ) report = response.choices[0].message.content sources_section = "\n\n---\n## Sources\n" + "\n".join(sources) return report + sources_section