githubEdit

Action Table - Image

1. Introduction

This tutorial will guide you through using the JamAI Base TypeScript 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:

  • Node.js 16.x 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:

Get your Project ID here:

3. Creating Your Action Table

1

Create action table

  • Navigate to your JamAI Base action table tab.

  • Create a new action table named "receipt".

2

Configure columns

Configure the following columns:

3

Configure output columns

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.ts:

Running the Example

1

Save the code as receipt_processor.ts

2

Create a .env file:

3

Install dependencies:

4

Run with:

Or compile and run:

Troubleshooting

chevron-rightFile not found errorhashtag
  • Check that the file path is correct

  • Use absolute paths or ensure relative paths are correct

chevron-rightUnsupported file formathashtag
  • Ensure image is in JPG, PNG, WEBP, or GIF format

  • Check file extension matches actual file type

chevron-rightUpload timeouthashtag
  • Check internet connection

  • Verify file size is reasonable (< 10MB recommended)

chevron-rightAPI errorshashtag
  • Verify your PAT and Project ID are correct

  • Check that the action table "receipt" exists in your project

Was this helpful?