Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -15,4 +15,102 @@ tags:
|
|
| 15 |
- agent-course
|
| 16 |
---
|
| 17 |
|
| 18 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
- agent-course
|
| 16 |
---
|
| 17 |
|
| 18 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 19 |
+
|
| 20 |
+
# AI Assistant Agent with Useful Tools
|
| 21 |
+
|
| 22 |
+
This Space provides an AI assistant agent built with the `smolagents` framework that can perform several useful tasks through specialized tools. The agent uses the Qwen2.5-Coder-32B-Instruct model to understand user requests and choose the appropriate tool to fulfill them.
|
| 23 |
+
|
| 24 |
+
## What This Agent Does
|
| 25 |
+
|
| 26 |
+
This agent serves as an intelligent assistant that can:
|
| 27 |
+
- Analyze text and provide detailed statistics
|
| 28 |
+
- Get current time in different timezones around the world
|
| 29 |
+
- Perform semantic search on text to find relevant information
|
| 30 |
+
- Provide documentation about its own capabilities
|
| 31 |
+
|
| 32 |
+
The agent uses a Gradio interface for easy interaction through natural language. Simply type your request, and the agent will handle the rest!
|
| 33 |
+
|
| 34 |
+
## Available Tools
|
| 35 |
+
|
| 36 |
+
### 1. Text Analyzer
|
| 37 |
+
|
| 38 |
+
This tool analyzes text and provides comprehensive statistics including:
|
| 39 |
+
- Word count
|
| 40 |
+
- Character count
|
| 41 |
+
- Unique words count
|
| 42 |
+
- Average word length
|
| 43 |
+
- Most common words (top 5)
|
| 44 |
+
|
| 45 |
+
### 2. Current Time in Timezone
|
| 46 |
+
|
| 47 |
+
Gets the current local time for any timezone in the world using the pytz library. The tool accepts standard timezone format names like:
|
| 48 |
+
- 'America/New_York'
|
| 49 |
+
- 'Europe/London'
|
| 50 |
+
- 'Asia/Tokyo'
|
| 51 |
+
- 'UTC'
|
| 52 |
+
|
| 53 |
+
### 3. Semantic Search
|
| 54 |
+
|
| 55 |
+
This tool performs semantic search on a corpus of text to find the most relevant sections matching a query. It uses:
|
| 56 |
+
- Bag-of-words vectorization for text representation
|
| 57 |
+
- Cosine similarity for relevance scoring
|
| 58 |
+
- Smart text chunking for better results
|
| 59 |
+
|
| 60 |
+
Note: While designed to also work with PDF documents, the current UI doesn't support file uploads. The semantic search works with text provided directly in the conversation.
|
| 61 |
+
|
| 62 |
+
### 4. Tools Documentation
|
| 63 |
+
|
| 64 |
+
A special tool that lists all available tools and provides usage examples for each. Access this by asking about the agent's capabilities.
|
| 65 |
+
|
| 66 |
+
## Example Queries to Try
|
| 67 |
+
|
| 68 |
+
### Text Analysis
|
| 69 |
+
- "Analyze this text: The quick brown fox jumps over the lazy dog."
|
| 70 |
+
- "Give me statistics about this paragraph: Lorem ipsum dolor sit amet, consectetur adipiscing elit."
|
| 71 |
+
|
| 72 |
+
### Timezone Queries
|
| 73 |
+
- "What time is it in Tokyo?"
|
| 74 |
+
- "Get the current time in America/New_York"
|
| 75 |
+
- "Tell me the time in UTC"
|
| 76 |
+
|
| 77 |
+
### Semantic Search
|
| 78 |
+
- "Search for 'climate change' in this text: Global warming is the long-term heating of Earth's surface observed since the pre-industrial period due to human activities, primarily fossil fuel burning, which increases heat-trapping greenhouse gas levels in Earth's atmosphere."
|
| 79 |
+
- "Find information about 'artificial intelligence' in this text: [paste your text here]"
|
| 80 |
+
|
| 81 |
+
### Getting Help
|
| 82 |
+
- "What tools do you have?"
|
| 83 |
+
- "Show me how to use this agent"
|
| 84 |
+
- "Help"
|
| 85 |
+
|
| 86 |
+
## Requirements and Dependencies
|
| 87 |
+
|
| 88 |
+
This agent requires:
|
| 89 |
+
- smolagents framework
|
| 90 |
+
- pytz for timezone functionality
|
| 91 |
+
- numpy for semantic search vector operations
|
| 92 |
+
- PyPDF2 (optional, for PDF processing if enabled)
|
| 93 |
+
|
| 94 |
+
## Usage Tips
|
| 95 |
+
|
| 96 |
+
1. Be specific in your requests
|
| 97 |
+
2. For semantic search, provide substantial text to search within
|
| 98 |
+
3. For timezone queries, use standard timezone names
|
| 99 |
+
|
| 100 |
+
## Limitations
|
| 101 |
+
|
| 102 |
+
- The current UI does not support file uploads for PDF processing
|
| 103 |
+
- Semantic search uses a simplified algorithm and works best with moderate amounts of text
|
| 104 |
+
- The agent has a maximum context length, so very large inputs may be truncated
|
| 105 |
+
|
| 106 |
+
## Future Development
|
| 107 |
+
|
| 108 |
+
Plans for future enhancements include:
|
| 109 |
+
- Adding file upload capabilities
|
| 110 |
+
- Implementing more sophisticated semantic search algorithms
|
| 111 |
+
- Adding additional tools like web scraping (when environment permits)
|
| 112 |
+
- Improving the PDF handling capabilities
|
| 113 |
+
|
| 114 |
+
---
|
| 115 |
+
|
| 116 |
+
Feel free to contribute to this project by providing feedback or suggesting new tools that would be useful!
|