nadim71 commited on
Commit
2a5ea16
ยท
verified ยท
1 Parent(s): b8b2875

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +176 -1
README.md CHANGED
@@ -12,4 +12,179 @@ hf_oauth: true
12
  hf_oauth_expiration_minutes: 480
13
  ---
14
 
15
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  hf_oauth_expiration_minutes: 480
13
  ---
14
 
15
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
16
+
17
+ Super Agent - Advanced Q&A Chatbot
18
+ ๐ŸŒŸ Introduction
19
+ GAIA Agent is a sophisticated AI-powered chatbot system designed to handle complex questions and tasks through an intuitive Q&A interface. Built on top of the GAIA benchmark framework, this agent combines advanced reasoning, code execution, web search, document processing, and multimodal understanding capabilities. The system features both a user-friendly chatbot interface and a comprehensive evaluation runner for benchmark testing.
20
+
21
+ ๐Ÿš€ Key Features
22
+ ๐Ÿ” Multi-Modal Search: Web search, Wikipedia, and arXiv paper search
23
+ ๐Ÿ’ป Code Execution: Support for Python, Bash, SQL, C, and Java
24
+ ๐Ÿ–ผ๏ธ Image Processing: Analysis, transformation, OCR, and generation
25
+ ๐Ÿ“„ Document Processing: PDF, CSV, Excel, and text file analysis
26
+ ๐Ÿ“ File Upload Support: Handle multiple file types with drag-and-drop
27
+ ๐Ÿงฎ Mathematical Operations: Complete set of mathematical tools
28
+ ๐Ÿ’ฌ Conversational Interface: Natural chat-based interaction
29
+ ๐Ÿ“Š Evaluation System: Automated benchmark testing and submission
30
+ ๐Ÿ—๏ธ Project Structure
31
+ gaia-agent/
32
+ โ”œโ”€โ”€ app.py # Main Q&A chatbot interface
33
+ โ”œโ”€โ”€ evaluation_app.py # GAIA benchmark evaluation runner
34
+ โ”œโ”€โ”€ agent.py # Core agent implementation with tools
35
+ โ”œโ”€โ”€ code_interpreter.py # Multi-language code execution
36
+ โ”œโ”€โ”€ image_processing.py # Image processing utilities
37
+ โ”œโ”€โ”€ system_prompt.txt # System prompt for the agent
38
+ โ”œโ”€โ”€ requirements.txt # Python dependencies
39
+ โ”œโ”€โ”€ metadata.jsonl # GAIA benchmark metadata
40
+ โ”œโ”€โ”€ explore_metadata.ipynb # Data exploration notebook
41
+ โ””โ”€โ”€ README.md # This file
42
+ ๐Ÿ› ๏ธ Tool Categories
43
+ ๐ŸŒ Browser & Search Tools
44
+ Wikipedia Search: Search Wikipedia with up to 2 results
45
+ Web Search: Tavily-powered web search with up to 3 results
46
+ arXiv Search: Academic paper search with up to 3 results
47
+ ๐Ÿ’ป Code Interpreter Tools
48
+ Multi-Language Execution: Python, Bash, SQL, C, Java support
49
+ Plot Generation: Matplotlib visualization support
50
+ DataFrame Analysis: Pandas data processing
51
+ Error Handling: Comprehensive error reporting
52
+ ๐Ÿงฎ Mathematical Tools
53
+ Basic Operations: Add, subtract, multiply, divide
54
+ Advanced Functions: Modulus, power, square root
55
+ Complex Numbers: Support for complex number operations
56
+ ๐Ÿ“„ Document Processing Tools
57
+ File Operations: Save, read, and download files
58
+ CSV Analysis: Pandas-based data analysis
59
+ Excel Processing: Excel file analysis and processing
60
+ OCR: Extract text from images using Tesseract
61
+ ๐Ÿ–ผ๏ธ Image Processing & Generation Tools
62
+ Image Analysis: Size, color, and property analysis
63
+ Transformations: Resize, rotate, crop, flip, adjust brightness/contrast
64
+ Drawing Tools: Add shapes, text, and annotations
65
+ Image Generation: Create gradients, noise patterns, and simple graphics
66
+ Image Combination: Stack and combine multiple images
67
+ ๐ŸŽฏ How to Use
68
+ Q&A Chatbot Interface (app.py)
69
+ Start the Chatbot:
70
+
71
+ python app.py
72
+ Access the Interface:
73
+
74
+ Open http://localhost:7860 in your browser
75
+ Upload files (images, documents, CSV, etc.) if needed
76
+ Ask questions in natural language
77
+ Get comprehensive answers with tool usage
78
+ Supported Interactions:
79
+
80
+ Text Questions: "What is the capital of France?"
81
+ Math Problems: "Calculate the square root of 144"
82
+ Code Requests: "Write a Python function to sort a list"
83
+ Image Analysis: Upload an image and ask "What do you see?"
84
+ Data Analysis: Upload a CSV and ask "What are the trends?"
85
+ Web Search: "What are the latest AI developments?"
86
+ Evaluation Runner (evaluation_app.py)
87
+ Run the Evaluation:
88
+
89
+ python evaluation_app.py
90
+ Benchmark Testing:
91
+
92
+ Log in with your Hugging Face account
93
+ Click "Run Evaluation & Submit All Answers"
94
+ Monitor progress as the agent processes GAIA benchmark questions
95
+ View results and scores automatically
96
+ ๐Ÿ”ง Technical Architecture
97
+ LangGraph State Machine
98
+ START โ†’ Retriever โ†’ Assistant โ†’ Tools โ†’ Assistant
99
+ โ†‘ โ†“
100
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
101
+ Retriever Node: Searches vector database for similar questions
102
+ Assistant Node: LLM processes question with available tools
103
+ Tools Node: Executes selected tools (web search, code, etc.)
104
+ Conditional Routing: Dynamically routes between assistant and tools
105
+ Vector Database Integration
106
+ Supabase Vector Store: Stores GAIA benchmark Q&A pairs
107
+ Semantic Search: Finds similar questions for context
108
+ HuggingFace Embeddings: sentence-transformers/all-mpnet-base-v2
109
+ Multi-Modal File Support
110
+ Images: JPG, PNG, GIF, BMP, WebP
111
+ Documents: PDF, DOC, DOCX, TXT, MD
112
+ Data: CSV, Excel, JSON
113
+ Code: Python, Bash, SQL, C, Java
114
+ โš™๏ธ Installation & Setup
115
+ 1. Clone Repository
116
+ git clone https://github.com/fisherman611/gaia-agent.git
117
+ cd gaia-agent
118
+ 2. Install Dependencies
119
+ pip install -r requirements.txt
120
+ 3. Environment Variables
121
+ Create a .env file with your API keys:
122
+
123
+ SUPABASE_URL=your_supabase_url
124
+ SUPABASE_SERVICE_ROLE_KEY=your_supabase_key
125
+ GROQ_API_KEY=your_groq_api_key
126
+ TAVILY_API_KEY=your_tavily_api_key
127
+ HUGGINGFACEHUB_API_TOKEN=your_hf_token
128
+ LANGSMITH_API_KEY=your_langsmith_key
129
+
130
+ LANGSMITH_TRACING=true
131
+ LANGSMITH_PROJECT=ai_agent_course
132
+ LANGSMITH_ENDPOINT=https://api.smith.langchain.com
133
+ 4. Database Setup (Supabase)
134
+ Execute this SQL in your Supabase database:
135
+
136
+ -- Enable pgvector extension
137
+ CREATE EXTENSION IF NOT EXISTS vector;
138
+
139
+ -- Create match function for documents2 table
140
+ CREATE OR REPLACE FUNCTION public.match_documents_2(
141
+ query_embedding vector(768)
142
+ )
143
+ RETURNS TABLE(
144
+ id bigint,
145
+ content text,
146
+ metadata jsonb,
147
+ embedding vector(768),
148
+ similarity double precision
149
+ )
150
+ LANGUAGE sql STABLE
151
+ AS $$
152
+ SELECT
153
+ id,
154
+ content,
155
+ metadata,
156
+ embedding,
157
+ 1 - (embedding <=> query_embedding) AS similarity
158
+ FROM public.documents2
159
+ ORDER BY embedding <=> query_embedding
160
+ LIMIT 10;
161
+ $$;
162
+
163
+ -- Grant permissions
164
+ GRANT EXECUTE ON FUNCTION public.match_documents_2(vector) TO anon, authenticated;
165
+ ๐Ÿš€ Running the Application
166
+ Chatbot Interface
167
+ python app.py
168
+ Access at: http://localhost:7860
169
+
170
+ Evaluation Runner
171
+ python evaluation_app.py
172
+ Access at: http://localhost:7860
173
+
174
+ Live Demo
175
+ Try it online: Hugging Face Space
176
+
177
+ ๐Ÿ”— Resources
178
+ GAIA Benchmark
179
+ Hugging Face Agents Course
180
+ LangGraph Documentation
181
+ Supabase Vector Store
182
+ ๐Ÿค Contributing
183
+ Contributions are welcome! Areas for improvement:
184
+
185
+ New Tools: Add specialized tools for specific domains
186
+ UI Enhancements: Improve the chatbot interface
187
+ Performance: Optimize response times and accuracy
188
+ Documentation: Expand examples and use cases
189
+ ๐Ÿ“„ License
190
+ This project is licensed under the MIT License.