File size: 4,206 Bytes
3d5952d
40959c4
3d5952d
 
 
 
800f185
3d5952d
8e046c1
3d5952d
 
8e046c1
4a5e2a6
42ed23b
4a5e2a6
42ed23b
4a5e2a6
42ed23b
 
 
 
4a5e2a6
42ed23b
4a5e2a6
42ed23b
 
 
 
 
 
 
 
4a5e2a6
42ed23b
4a5e2a6
42ed23b
 
 
 
 
 
4a5e2a6
42ed23b
9243126
42ed23b
 
 
9243126
42ed23b
9243126
42ed23b
 
 
 
9243126
42ed23b
9243126
42ed23b
 
 
9243126
42ed23b
 
 
9243126
42ed23b
9243126
42ed23b
4a5e2a6
42ed23b
9243126
42ed23b
 
 
 
 
 
 
4a5e2a6
42ed23b
 
 
 
 
 
 
4a5e2a6
42ed23b
4a5e2a6
42ed23b
 
 
4a5e2a6
42ed23b
4a5e2a6
42ed23b
4a5e2a6
42ed23b
 
 
8e046c1
 
 
 
 
06cfec6
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
title: CrewAI Multiagent Research Tool
emoji: πŸ“ˆ
colorFrom: blue
colorTo: blue
sdk: gradio
sdk_version: 5.9.1
app_file: app.py
pinned: true
license: cc-by-nc-nd-4.0
---
# CrewAI Multiagent Research Tool

Welcome to the **CrewAI Research Tool** on Hugging Face Spaces! This tool leverages **Gradio**, **Cohere**, **CrewAI**, and **Azure/OpenAI technologies** to automate and streamline online research, compile reports, and extract data through web crawling.

## πŸ“ Description

The CrewAI Research Tool uses advanced AI capabilities to:
- Gather, analyze, and compile information on various topics.
- Deliver comprehensive, structured reports.
- Automate the research process, from web searching to report generation.

## πŸš€ Features

- **Web Search Automation**: 
  - Uses the DuckDuckGo search engine to perform searches and gather detailed results.
- **Data Extraction and Summarization**:
  - Extracts and summarizes web content using web scraping tools and LLMs.
- **Detailed Report Generation**: 
  - Agents like 'Researcher' and 'Editor' sequentially craft polished reports based on findings.
- **Interactive Gradio Interface**: 
  - Allows users to input research topics and generate reports with a single button click.

## πŸ›  Tools and Technologies

- **CrewAI**: 
  - Orchestrates agents with specific roles to automate workflows.
- **OpenAI, Azure OpenAI Services, and Groq**: 
  - Employs large language models for understanding and content generation.
- **Gradio**: 
  - Provides an intuitive web interface for user interaction.

## βš™οΈ Utility Functions

- **`setup_logging()`**: Configures logging to output messages to the console.
- **`export_to_markdown(result)`**: Saves the generated report to a Markdown file.
- **`fetch_content(url)`**: Retrieves content from a URL, handling both PDFs and web articles.

### Custom Tools

- **`search_results(search_query: str) -> list`**: 
  - Performs a web search using DuckDuckGo and returns a list of results.
- **`web_scrapper(url: str, topic: str) -> str`**: 
  - Extracts and summarizes content from a URL related to a topic.

## πŸ€– AI Agents and Tasks

### Agents
1. **Researcher**: Gathers detailed information on a specified topic using search and scraping tools.
2. **Editor**: Refines the collected data into a structured, polished report.

### Tasks
- **`research_task`**: Directs the Researcher to collect and draft information.
- **`edit_task`**: Guides the Editor to refine drafts into final reports.

## 🧠 Crew Orchestration

The **Crew** class manages agents and tasks, ensuring proper execution order and seamless interactions.

## πŸ’» How to Use

The user interface, built with **Gradio**, includes:
- **Model Selection**: Choose between AI models (Azure, OpenAI, Groq-Cohere).
- **API Key Inputs**: Provide necessary API keys for the selected model.
- **Topic Input**: Enter the research topic.
- **Buttons**: 
  - **Start Research**: Initiates the research process.
  - **Export to Markdown**: Saves the report as a Markdown file.

### Steps
1. **Select a Model**: Use the radio buttons to choose your preferred AI model.
2. **Enter API Keys**: Fill in the required API keys based on the model.
3. **Enter a Topic**: Type your research topic into the textbox.
4. **Start Research**: Click the button to generate the report.
5. **View Results**: See the generated report in the output section.
6. **Export Report**: Save the report as a Markdown file for future reference.

## 🌟 Contributions and Feedback

We welcome contributions! 
- Duplicate this Space, make improvements, and submit a pull request.
- For feedback and issues, open an issue in the project's Community tab.

## πŸ“œ License

This project is licensed under the **cc-by-nc-nd-4.0**.

## πŸ™ Acknowledgments

Special thanks to the open-source projects and APIs that made this tool possible:
- [CrewAI](https://crewai.com)
- [OpenAI](https://openai.com)
- [Azure OpenAI Services](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
- [Cohere](https://cohere.com)
- [Groq](https://groq.com)
- [DuckDuckGoSeach](https://pypi.org/project/duckduckgo-search/)

And of course to [Hugging Face](https://huggingface.co)!! πŸ€—