Skip to main content

When to Use the Python API

The API gives you full programmatic control for building custom applications.

Best For

  • Custom applications - Build your own tools
  • Complex workflows - Multi-step pipelines
  • Dynamic configuration - Adjust on the fly
  • Integration - Connect with existing code
  • Production systems - Deploy as services

What It Looks Like

Write Python code:

Workflow Example

Advantages

  • Full control - Access everything
  • Custom logic - Your preprocessing
  • Integration - Works with any Python library
  • Dynamic - Adjust based on conditions
  • Testable - Unit test your training

Limitations

  • More code - You write the orchestration
  • Complexity - Handle errors yourself
  • Python only - Not language agnostic
  • Dependencies - Manage packages

When to Switch

Use CLI when you:
  • Need simple automation
  • Want language agnostic solution
  • Prefer configuration over code
  • Work with non-Python tools
Use UI when you:
  • Need visual feedback
  • Teaching others
  • Quick experiments
  • Data exploration

Common Use Cases

Web Service

Data Pipeline

A/B Testing

Custom Callbacks

Tips for API Users

  1. Handle exceptions - Training can fail
  2. Add logging - Track what happens
  3. Use type hints - Catch errors early
  4. Write tests - Ensure reliability
  5. Document code - Others will use it

API-Exclusive Features

Things only the API can do:
  • Custom callbacks during training
  • Dynamic model selection
  • Complex data pipelines
  • Embedded in applications
  • Programmatic hyperparameter tuning

Essential Patterns

Integration Examples

Next Steps

API Reference

Full API documentation

CLI Alternative

When commands are simpler