/ examples / capabilities / batches_example.py
batches_example.py
 1  """
 2  Batches Capabilities Example
 3  
 4  Demonstrates batch processing using PraisonAI capabilities.
 5  """
 6  
 7  from praisonai.capabilities import batch_list
 8  
 9  print("=== Batch List ===")
10  try:
11      batches = batch_list()
12      print(f"Batches found: {len(batches)}")
13      for b in batches[:5]:  # Show first 5
14          print(f"  - {b.get('id', 'unknown')}: {b.get('status', 'unknown')}")
15  except Exception as e:
16      print(f"Note: {e}")
17      print("Batch operations require batch jobs to be created first.")
18  
19  print("\n=== Batch Operations ===")
20  print("Available functions:")
21  print("  batch_create(input_file_id, endpoint, completion_window='24h')")
22  print("  batch_list()")
23  print("  batch_retrieve(batch_id)")
24  print("  batch_cancel(batch_id)")
25  
26  print("\nSee CLI: praisonai batches list")
27  print("See CLI: praisonai batches create <input_file_id>")