File size: 2,453 Bytes
0c2b47c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d5e6f1c
0c2b47c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Intelligent AI Search Engine Agent πŸ€–πŸ”Ž

An intelligent agentic search engine powered by **Groq's Llama3-8b**, Streamlit, and multi-source search tools (DuckDuckGo, Arxiv, Wikipedia). Built with LangChain for robust AI agent orchestration.

## Features ✨
- **Multi-Source Search**: Integrates 3 powerful tools:
  - πŸ¦† DuckDuckGo (web search)
  - πŸ“š Arxiv (scientific papers)
  - 🌐 Wikipedia (encyclopedic knowledge)
- **Groq-Powered AI**: Utilizes Groq's ultra-fast Llama3-8b model
- **Smart Agent Optimization**:
  - Auto-stop when sufficient information is found
  - Max 3 iterations to prevent infinite loops
  - Concise answer prioritization
- **Streamlit UI**: User-friendly interface with chat history
- **Error Handling**: Robust parsing and API error recovery

## Getting Started πŸš€

### Prerequisites
- Python 3.8+
- [Groq API Key](https://console.groq.com/)
- `.env` file for API keys (optional)

### Installation
```bash
git clone https://github.com/yourusername/ai-search-agent.git
cd ai-search-agent
pip install -r requirements.txt
```

### Setup
1. Get Groq API key from [Groq Console](https://console.groq.com/)
2. Create `.env` file:
```env
GROQ_API_KEY=your_key_here
```

### Run the App
```bash
streamlit run app2.py  # Recommended: optimized version
# or
streamlit run app.py
```

## Usage πŸ’‘
1. Enter Groq API key in sidebar
2. Ask questions in natural language:
   - "Explain quantum computing basics"
   - "Latest research on LLM optimization"
   - "Compare CNN and RNN architectures"
3. Watch the agent intelligently combine search sources!

## Code Versions πŸ”„
- **`app.py`**: Base implementation with custom DuckDuckGo search
- **`app2.py` (Recommended)**: Enhanced version with:
  - Official DuckDuckGoSearchRun tool
  - System instruction prompts
  - Limited iterations (3 max)
  - Early stopping mechanism
  - More robust error handling

## Deployment ☁️
Project is Deployed at Streamlit Community Cloud:

1. Go to [Streamlit Console](https://search-engine-ai-agent-mfwywkerzwtdxllpt9mhj6.streamlit.app/)
2. Enter your Groq API Key
3. Search your query with Intelligent AI Search-Engine

## Contributing 🀝
PRs welcome! Please follow:
1. Fork the repository
2. Create feature branch
3. Submit PR with detailed description

## License πŸ“„
MIT License - See [LICENSE](LICENSE)

## Acknowledgments πŸ™
- Groq for LLM infrastructure
- LangChain team for agent framework
- Streamlit for UI components