from gpt_researcher import GPTResearcher
import asyncio
async def main():
"""
This is a sample script that shows how to run a research report.
"""
query = "What happened in the latest burning man floods?"
report_type = "research_report"
researcher = GPTResearcher(query=query, report_type=report_type, config_path=None)
await researcher.conduct_research()
report = await researcher.write_report()
return report
if __name__ == "__main__":
asyncio.run(main())
```python
from gpt_researcher import GPTResearcher
import asyncio
async def main():
"""
This example shows how to use custom prompts to control report formatting.
"""
query = "What are the latest advancements in renewable energy?"
report_type = "research_report"
researcher = GPTResearcher(query=query, report_type=report_type)
await researcher.conduct_research()
standard_report = await researcher.write_report()
print("Standard Report Generated")
custom_prompt = "Provide a concise summary in 2 paragraphs without citations."
short_report = await researcher.write_report(custom_prompt=custom_prompt)
print("Short Report Generated")
bullet_prompt = "List the top 5 advancements as bullet points with brief explanations."
bullet_report = await researcher.write_report(custom_prompt=bullet_prompt)
print("Bullet-Point Report Generated")
return standard_report, short_report, bullet_report
if __name__ == "__main__":
asyncio.run(main())
For more comprehensive examples of using custom prompts, see the `custom_prompt.py` file included in the examples directory.