Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Box AI Extract Quickstart

A Python application that demonstrates how to use Box AI to extract metadata from files in Box with a flexible string. This quickstart guide will walk you through these steps.

Prerequisites

  • Python 3.11+
  • Box Developer Account
  • Box App with appropriate permissions

Setup

  1. Clone the repository

    git clone https://github.com/box-community/box-quickstarts.git
    cd box-ai-freeform-extract-quickstart
  2. Create virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install python-dotenv "boxsdk>=10"
  4. Configure environment variables

    cp .env.template .env

    Edit .env and add your values:

    • BOX_DEVELOPER_TOKEN: Your Box developer token
    • BOX_FILE_ID: ID of the file to extract metadata from

Usage

Run the extraction script:

python extract.py

The script will:

  1. Authenticate with Box using your developer token
  2. Extract structured metadata from the specified file using Box AI
  3. Attach the extracted metadata to the file

Box Setup Requirements

  1. Create a Box App with Client Credentials Grant authentication
  2. Ensure your app the following scopes:
  • Read all files and folders stored in Box
  • Manage AI
  1. Upload a file to Box and note its file ID

Project Structure

  • freeform_extract.py - Main application script
  • .env.template - Environment variables template
  • .env - Your environment variables (not tracked in git)
  • .gitignore - Git ignore rules for Python projects