Spaces:
Runtime error
Runtime error
| # Import libraries | |
| from pydantic import BaseModel, Field | |
| from agents import Agent | |
| # Define instructions for the writer agent | |
| WRITER_INSTRUCTIONS = ( | |
| "You are a senior researcher tasked with writing a cohesive report for a research query. " | |
| "You will be provided with the original query, and some initial research done by a research assistant.\n" | |
| "You should first come up with an outline for the report that describes the structure and " | |
| "flow of the report. Then, generate the report and return that as your final output.\n" | |
| "The final output should be in markdown format, and it should be lengthy and detailed. Aim " | |
| "for 5-10 pages of content, at least 1000 words." | |
| ) | |
| # Create the pydantic model to store the final report | |
| class ReportData(BaseModel): | |
| short_summary: str = Field(description="A short 2-3 sentence summary of the findings") | |
| markdown_report: str = Field(description="The final report") | |
| follow_up_questions: str = Field(description="Suggested topics to research further") | |
| # Create the writer_agent | |
| writer_agent = Agent( | |
| name="Report Writing Agent", | |
| instructions=WRITER_INSTRUCTIONS, | |
| model="gpt-4o-mini", | |
| output_type=ReportData, | |
| ) |