Before you Begin
Complete the Python Client Setup before continuing. You’ll need Python 3.10+ and your API key configured. For information on environment variables, see Environment Variables.1. Create and Run a Lens Session
1. Setup
If you haven’t already done so, see these instructions to install the Archetype AI python client or directly run the following in your terminal:"insert_your_key" with your actual API key from Archetype AI.
2. Create and Run a Lens Session
Next, you will create a Python example that defines and runs a custom Lens on a pre-recorded video. A Lens controls how data is ingested, interpreted, and returned by Newton. Default parameters are provided and can be adjusted later. The parameters within the lens configuration can be edited to customize the analysis for your specific needs. Open the following code snippet in your text editor to get started:example.py, then run the following in your terminal:
your_test_video.mp4 with the actual name of your video file. Download our sample delivery video to follow along:
2. What you should see
After running the command, you should see the description of the video stream live in your terminal. Here’s an example response:'response': ['The video shows a FedEx Ground delivery truck parked on a residential driveway. A delivery person exits the truck carrying a package. The environment appears to be a suburban neighborhood with well-maintained lawns and a clear sky.']
Lenses created via the API will appear in your Workbench where you can monitor sessions, view results, and manage your lens configurations.
Try Variations
Using the same video (or a starter video), experiment with how Lens parameters affect the output:- Edit Instruction - Modify the
--instructionargument to change what the model analyzes:
- Adjust Temporal Focus - The temporal focus controls how large of a time window the Newton model analyzes per inference. Change
temporal_focusin the code from5seconds to20seconds to compare shorter vs. longer time windows for analysis.
Troubleshooting
If you’re getting errors, see the Troubleshooting page for common issues and solutions, or check the Python Client documentation for installation and upgrade instructions.Learn More
Core Concepts
Learn the fundamentals of the Newton AI platform.
Lenses Overview
Understand how to build physical AI agents to interpret sensor data.
Video File Reader
Reads sensor data from a Video file.
RTSP Video Reader
Reads real-time video data from an RTSP camera.
Files
Manage your data uploads and supported file formats.
Code Examples
Try working examples to get hands-on experience with ArchetypeAI.