This tutorial will guide you through using the JamAI Base SDK to create a simple receipt information extraction system.
What We'll Build
Snap a photo of your receipt and let AI do the expense report for you!
In this tutorial, we'll create a receipt processing system that:
Takes a receipt image as input
Uploads it to JamAI Base action table
Extracts key information like:
Shop name
Total amount
Prerequisites
Before starting, you'll need:
Python 3.11 or higher installed
Project ID and Personal Access Token (PAT)
2. Installation and Setup
Installing the SDK
Basic Configuration
Get your Personal Access Token (PAT) here:
How to generate PAT
Get your Project ID here:
How to get Project ID
3. Creating Your Action Table
For simplicity, you can set up your action table in the JamAI Base platform:
Navigate to your JamAI Base action table tab
Create a new action table named "receipt"
Configure the following columns:
Create new action table
Created table
4. Basic Implementation
4.1 Simple Receipt Processor
4.2 Complete Implementation with Error Handling
5. Usage Examples
5.1 Basic Usage
5.2 Batch Processing
6. Best Practices
Error Handling
Always validate input files
Handle network errors gracefully
Performance
Reuse the client instance
Consider batch processing for multiple files
Implement rate limiting for large batches
Security
Use environment variables for credentials
Complete Standalone Example
Save this as receipt_processor.py:
How to Run
Save the code above as receipt_processor.py
Install required package:
Run for a single receipt:
Run for a folder of receipts:
Example Output
The receipt table with the uploaded image.
Features
Processes single images or entire folders
Validates file types and existence
Provides clear progress feedback
Formats results in an easy-to-read way
Includes error handling
Command-line argument support
This standalone example provides a complete, working implementation that you can use as a starting point for your own projects or modify according to your needs.