(no commit message)

This commit is contained in:
2025-10-25 03:28:44 -04:00
parent c1462fa1f8
commit 655ded986e
2 changed files with 116 additions and 14 deletions

112
README.md
View File

@@ -0,0 +1,112 @@
# Modaic AutoAgent Quickstart
A simple quickstart project demonstrating how to use Modaic's AutoAgent for receipt classification and cost extraction from images.
## Overview
This project shows how to:
- Use a precompiled agent from the Modaic Hub
- Extract cost information from receipt images
- Configure agent parameters like max tokens
## Prerequisites
- Python 3.11 or higher
- Modaic account and API token
- OpenAI API key
## Installation
1. **Install dependencies:**
```bash
uv add modaic
# or with pip:
pip install modaic
```
2. **Set up environment variables:**
Create a `.env` file in the project root with your API keys:
```
MODAIC_TOKEN=your_modaic_token_here
OPENAI_API_KEY=your_openai_api_key_here
```
## Usage
### Basic Example
```python
from modaic import AutoAgent
# Load a precompiled receipt classifier from the Modaic Hub
receipt_classifier = AutoAgent.from_precompiled(
"farouk1/receipt-classifier",
config_options={"max_tokens": 500}
)
# Analyze a receipt image and extract the total cost
results = receipt_classifier(
"https://ocr.space/Content/Images/receipt-ocr-original.webp"
)
print(results.total_cost) # Output: 98.21
```
### What This Does
1. **Loads a precompiled agent** - The `farouk1/receipt-classifier` agent is downloaded from the Modaic Hub
2. **Configures the agent** - Sets max_tokens to 500 for response length control
3. **Processes an image** - Analyzes the receipt image from the provided URL
4. **Extracts cost data** - Returns the total cost found on the receipt
## Key Features
- **Precompiled Agents**: Use ready-made agents from the Modaic Hub
- **Image Processing**: Direct support for image URLs and analysis
- **Configurable Parameters**: Customize agent behavior with config options
- **Simple API**: Just a few lines of code to get started
## Getting API Keys
### Modaic Token
1. Sign up at [Modaic](https://modaic.dev)
2. Navigate to your account settings
3. Generate an API token
### OpenAI API Key
1. Sign up at [OpenAI](https://platform.openai.com)
2. Go to API keys section
3. Create a new API key
## Project Structure
```
quickstart/
.env # API keys (not committed to git)
.gitignore # Git ignore patterns
main.py # Agent implementation and hub upload
pyproject.toml # Project dependencies and metadata
README.md # This file
uv.lock # Dependency lock file
```
## Running the Example
```bash
python main.py
```
This will run the quickstart example and display the extracted total cost from the receipt image.
## Next Steps
- Explore more precompiled agents on the [Modaic Hub](https://hub.modaic.dev)
- Learn about creating your own agents with the Modaic SDK
- Check out the [Modaic documentation](https://docs.modaic.dev) for advanced features
## Support
For questions or issues:
- Visit the [Modaic documentation](https://docs.modaic.dev)
- Check the [GitHub repository](https://github.com/modaic/modaic)
- Join the community discussions