Skip to main content
Lens customization is the simplest way to adapt Newton to your use case. It involves creating or modifying the parameters of a lens without having to provide any additional training data. At a high level, a lens lets you configure two key components of a lens:
  • Lens Parameters: such as the instruction and focus of the lens
  • Lens Data Streams: such as what sensors should be connected to a lens and where the lens output should be streamed.

What You Can Configure

Instruction and Focus

The instruction and focus parameters in lens_parameters tell Newton what to look for and how to respond. These are analogous to system prompts in traditional LLMs, but are specifically designed for physical-world reasoning tasks.
lens_parameters:
  instruction: |
    You are an intelligent traffic monitoring system. Monitor the traffic feed 
    for the following activity or object.
    Output alerts in the format: [alert]{activity or object name}: {description}
  focus: All red pickup trucks driving east.
Best practices for instructions:
  • Be specific about the output format you expect
  • Provide context about the sensor placement or environment (e.g., “this camera is on 104th and main street looking west-to-east”)
  • Clearly define what constitutes an alert or event worth reporting

Input and Output Streams

Configure how data flows into and out of the lens: Each lens can be customized to read and write from dedicated data streams. For example, a developer can stream data from a CSV file or video file into a lens and then stream the results back to an external application via a Server Sent Events stream. Available stream types are documented in the Streams section. The example below demonstrates how a CSV file can be hooked up and streamed into a lens.
input_streams:
  - stream_type: csv_file_reader
    stream_config:
      file_id: data.csv
      window_size: 1024
      step_size: 1024
output_streams:
  - stream_type: server_sent_events_writer
Available stream types are documented in the Streams section.

Lens-Specific Parameters

Different lenses expose different configuration options. Common parameters include:
ParameterDescriptionExample
buffer_sizeNumber of samples to buffer before processing1024
window_sizeSize of the sliding window for analysis1024
step_sizeHow far to advance the window between analyses512
normalize_inputWhether to normalize input datatrue
Refer to the documentation for your specific lens to see all available parameters.

When to Use Lens Customization

Lens customization is appropriate when:
  • You’re getting started and want to quickly test different configurations.
  • You want to change what Newton focuses on for your specific use case, such as real-time safety alerts in a factory.
  • Your use case or sensor data does not require extensive customization.

Next Steps

If lens customization alone isn’t achieving the results you need, consider adding N-Shot Examples to guide Newton’s behavior with labeled examples.