universal-mcp 0.1.9rc1__py3-none-any.whl → 0.1.9rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. universal_mcp/applications/application.py +19 -30
  2. universal_mcp/applications/cal_com_v2/app.py +1676 -1021
  3. universal_mcp/applications/clickup/app.py +1496 -846
  4. universal_mcp/applications/falai/README.md +42 -0
  5. universal_mcp/applications/falai/__init__.py +0 -0
  6. universal_mcp/applications/falai/app.py +332 -0
  7. universal_mcp/applications/gong/README.md +88 -0
  8. universal_mcp/applications/gong/__init__.py +0 -0
  9. universal_mcp/applications/gong/app.py +2297 -0
  10. universal_mcp/applications/hashnode/app.py +12 -8
  11. universal_mcp/applications/hashnode/prompt.md +2 -0
  12. universal_mcp/applications/heygen/README.md +69 -0
  13. universal_mcp/applications/heygen/__init__.py +0 -0
  14. universal_mcp/applications/heygen/app.py +956 -0
  15. universal_mcp/applications/mailchimp/app.py +3848 -1794
  16. universal_mcp/applications/replicate/README.md +47 -35
  17. universal_mcp/applications/replicate/__init__.py +0 -0
  18. universal_mcp/applications/replicate/app.py +215 -204
  19. universal_mcp/applications/retell_ai/app.py +84 -67
  20. universal_mcp/applications/rocketlane/app.py +49 -35
  21. universal_mcp/applications/spotify/app.py +723 -428
  22. universal_mcp/applications/supabase/app.py +909 -583
  23. universal_mcp/servers/server.py +50 -0
  24. universal_mcp/stores/store.py +2 -3
  25. universal_mcp/utils/docstring_parser.py +67 -36
  26. {universal_mcp-0.1.9rc1.dist-info → universal_mcp-0.1.9rc2.dist-info}/METADATA +5 -1
  27. {universal_mcp-0.1.9rc1.dist-info → universal_mcp-0.1.9rc2.dist-info}/RECORD +29 -19
  28. {universal_mcp-0.1.9rc1.dist-info → universal_mcp-0.1.9rc2.dist-info}/WHEEL +0 -0
  29. {universal_mcp-0.1.9rc1.dist-info → universal_mcp-0.1.9rc2.dist-info}/entry_points.txt +0 -0
@@ -37,17 +37,17 @@ class ReplicateApp(APIApplication):
37
37
  def account_get(self) -> dict[str, Any]:
38
38
  """
39
39
  Gets information about the authenticated account.
40
-
40
+
41
41
  Args:
42
42
  None: This function takes no parameters.
43
-
43
+
44
44
  Returns:
45
45
  Dict[str, Any]: A dictionary containing account details including type, username, name, and other account-related information.
46
-
46
+
47
47
  Raises:
48
48
  HTTPError: When the API request fails or returns a non-200 status code
49
49
  RequestException: When there are network connectivity issues or other request-related problems
50
-
50
+
51
51
  Tags:
52
52
  account, get, read, api, authentication, important
53
53
  """
@@ -61,16 +61,16 @@ class ReplicateApp(APIApplication):
61
61
  def collections_list(self) -> dict[str, Any]:
62
62
  """
63
63
  Lists collections of models available on Replicate, returning a paginated list of collection objects.
64
-
64
+
65
65
  Args:
66
66
  None: This function takes no arguments other than self
67
-
67
+
68
68
  Returns:
69
69
  A dictionary containing a paginated list of collection objects from the Replicate API
70
-
70
+
71
71
  Raises:
72
72
  HTTPError: When the API request fails or returns a non-200 status code
73
-
73
+
74
74
  Tags:
75
75
  list, collections, read, api, important, fetch, models
76
76
  """
@@ -80,76 +80,81 @@ class ReplicateApp(APIApplication):
80
80
  return response.json()
81
81
 
82
82
  def collections_get(self, collection_slug: str) -> dict[str, Any]:
83
- """
84
- Retrieves detailed information about a specific model collection, with automatic truncation of large model lists to manage response size.
85
-
86
- Args:
87
- collection_slug: The unique identifier (slug) for the collection to retrieve (e.g., 'super-resolution')
88
-
89
- Returns:
90
- A dictionary containing collection details and its associated models. If the model list exceeds the truncation threshold (15), returns a modified dictionary with the model list replaced by a summary count and message.
91
-
92
- Raises:
93
- HTTPError: Raised when the API request fails or returns an error status code
94
- RequestException: Raised when there's a network-related error during the API request
95
-
96
- Tags:
97
- get, read, collections, api, data-retrieval, important, truncation
98
- """
99
- url = f"{self.base_url}/collections/{collection_slug}"
100
- response = self._get(url)
101
- response.raise_for_status()
102
- collection_data = response.json()
103
- if 'models' in collection_data and isinstance(collection_data['models'], list):
104
- original_model_count = len(collection_data['models'])
105
-
106
- # Define a threshold for truncation.
107
- # This is a heuristic value. You might need to adjust this number
108
- # based on how many model objects typically fit within your LLM's context,
109
- # considering the size of each model object description.
110
- TRUNCATION_THRESHOLD = 10 # Example: Truncate if more than 15 models
111
-
112
- if original_model_count > TRUNCATION_THRESHOLD:
113
- logger.warning(f"Truncating model list for collection '{collection_slug}'. Found {original_model_count} models, exceeding threshold {TRUNCATION_THRESHOLD}.")
114
-
115
- # Create a new dictionary with essential collection data
116
- # and replace the 'models' list with a summary.
117
- truncated_data = {
118
- k: v for k, v in collection_data.items()
119
- if k != 'models' # Exclude the full models list
120
- }
121
- # Add information about the models list being truncated
122
- truncated_data['model_count'] = original_model_count
123
- truncated_data['models'] = f"List of {original_model_count} models omitted due to size. Use models_get for details on individual models by owner/name."
124
- # Optionally, include a small number of models as a preview, but this adds size.
125
- # For maximum reduction, just provide the count and message.
126
- # truncated_data['models_preview'] = collection_data['models'][:5] # Example: include first 5 models
127
-
128
- return truncated_data
129
- else:
130
- # If the list is not too large, return the full data
131
- return collection_data
83
+ """
84
+ Retrieves detailed information about a specific model collection, with automatic truncation of large model lists to manage response size.
85
+
86
+ Args:
87
+ collection_slug: The unique identifier (slug) for the collection to retrieve (e.g., 'super-resolution')
88
+
89
+ Returns:
90
+ A dictionary containing collection details and its associated models. If the model list exceeds the truncation threshold (15), returns a modified dictionary with the model list replaced by a summary count and message.
91
+
92
+ Raises:
93
+ HTTPError: Raised when the API request fails or returns an error status code
94
+ RequestException: Raised when there's a network-related error during the API request
95
+
96
+ Tags:
97
+ get, read, collections, api, data-retrieval, important, truncation
98
+ """
99
+ url = f"{self.base_url}/collections/{collection_slug}"
100
+ response = self._get(url)
101
+ response.raise_for_status()
102
+ collection_data = response.json()
103
+ if "models" in collection_data and isinstance(collection_data["models"], list):
104
+ original_model_count = len(collection_data["models"])
105
+
106
+ # Define a threshold for truncation.
107
+ # This is a heuristic value. You might need to adjust this number
108
+ # based on how many model objects typically fit within your LLM's context,
109
+ # considering the size of each model object description.
110
+ TRUNCATION_THRESHOLD = 10 # Example: Truncate if more than 15 models
111
+
112
+ if original_model_count > TRUNCATION_THRESHOLD:
113
+ logger.warning(
114
+ f"Truncating model list for collection '{collection_slug}'. Found {original_model_count} models, exceeding threshold {TRUNCATION_THRESHOLD}."
115
+ )
116
+
117
+ # Create a new dictionary with essential collection data
118
+ # and replace the 'models' list with a summary.
119
+ truncated_data = {
120
+ k: v
121
+ for k, v in collection_data.items()
122
+ if k != "models" # Exclude the full models list
123
+ }
124
+ # Add information about the models list being truncated
125
+ truncated_data["model_count"] = original_model_count
126
+ truncated_data["models"] = (
127
+ f"List of {original_model_count} models omitted due to size. Use models_get for details on individual models by owner/name."
128
+ )
129
+ # Optionally, include a small number of models as a preview, but this adds size.
130
+ # For maximum reduction, just provide the count and message.
131
+ # truncated_data['models_preview'] = collection_data['models'][:5] # Example: include first 5 models
132
+
133
+ return truncated_data
132
134
  else:
133
- # If 'models' key is missing or not a list, return the data as is
134
- # (This handles cases where the structure is unexpected, or an error occurred before this point)
135
+ # If the list is not too large, return the full data
135
136
  return collection_data
137
+ else:
138
+ # If 'models' key is missing or not a list, return the data as is
139
+ # (This handles cases where the structure is unexpected, or an error occurred before this point)
140
+ return collection_data
136
141
 
137
142
  # --- Deployment Operations ---
138
143
 
139
144
  def deployments_list(self) -> dict[str, Any]:
140
145
  """
141
146
  Lists all deployments associated with the authenticated account.
142
-
147
+
143
148
  Args:
144
149
  None: This function takes no arguments.
145
-
150
+
146
151
  Returns:
147
152
  Dict[str, Any]: A dictionary containing a paginated list of deployment objects with deployment details and metadata.
148
-
153
+
149
154
  Raises:
150
155
  HTTPError: When the API request fails or returns a non-200 status code
151
156
  RequestException: When there are network connectivity issues or API communication errors
152
-
157
+
153
158
  Tags:
154
159
  list, read, deployments, api, management, important
155
160
  """
@@ -169,7 +174,7 @@ class ReplicateApp(APIApplication):
169
174
  ) -> dict[str, Any]:
170
175
  """
171
176
  Creates a new model deployment with specified configuration parameters.
172
-
177
+
173
178
  Args:
174
179
  name: The name of the deployment
175
180
  model: The full name of the model (e.g., 'stability-ai/sdxl')
@@ -177,13 +182,13 @@ class ReplicateApp(APIApplication):
177
182
  hardware: The SKU for the hardware (e.g., 'gpu-t4')
178
183
  min_instances: The minimum number of instances, ranging from 0 to 5
179
184
  max_instances: The maximum number of instances, ranging from 0 to 20
180
-
185
+
181
186
  Returns:
182
187
  Dictionary containing the details of the newly created deployment
183
-
188
+
184
189
  Raises:
185
190
  HTTPError: When the API request fails or returns a non-200 status code
186
-
191
+
187
192
  Tags:
188
193
  create, deployment, configuration, api, infrastructure, scaling, important
189
194
  """
@@ -200,20 +205,22 @@ class ReplicateApp(APIApplication):
200
205
  response.raise_for_status()
201
206
  return response.json()
202
207
 
203
- def deployments_get(self, deployment_owner: str, deployment_name: str) -> dict[str, Any]:
208
+ def deployments_get(
209
+ self, deployment_owner: str, deployment_name: str
210
+ ) -> dict[str, Any]:
204
211
  """
205
212
  Retrieves detailed information about a specific deployment by its owner and name.
206
-
213
+
207
214
  Args:
208
215
  deployment_owner: The owner's username or organization name associated with the deployment
209
216
  deployment_name: The unique name identifier of the deployment
210
-
217
+
211
218
  Returns:
212
219
  A dictionary containing detailed information about the requested deployment
213
-
220
+
214
221
  Raises:
215
222
  HTTPError: When the HTTP request fails or returns a non-200 status code
216
-
223
+
217
224
  Tags:
218
225
  get, read, deployments, api, fetch, important
219
226
  """
@@ -233,7 +240,7 @@ class ReplicateApp(APIApplication):
233
240
  ) -> dict[str, Any]:
234
241
  """
235
242
  Updates configurable properties of an existing deployment, such as hardware specifications and instance scaling parameters.
236
-
243
+
237
244
  Args:
238
245
  deployment_owner: The owner's username or organization name
239
246
  deployment_name: The name of the deployment to be updated
@@ -241,13 +248,13 @@ class ReplicateApp(APIApplication):
241
248
  max_instances: Optional. The new maximum number of instances for scaling
242
249
  min_instances: Optional. The new minimum number of instances for scaling
243
250
  version: Optional. The new ID of the model version to deploy
244
-
251
+
245
252
  Returns:
246
253
  Dictionary containing the updated deployment configuration details or a message if no updates were provided
247
-
254
+
248
255
  Raises:
249
256
  HTTPError: Raised when the API request fails or returns an error status code
250
-
257
+
251
258
  Tags:
252
259
  update, deployments, configuration, scaling, management, important
253
260
  """
@@ -260,7 +267,7 @@ class ReplicateApp(APIApplication):
260
267
  }
261
268
  update_data = {k: v for k, v in update_data.items() if v is not None}
262
269
  if not update_data:
263
- return {"message": "No update parameters provided."}
270
+ return {"message": "No update parameters provided."}
264
271
  response = self._patch(url, data=update_data)
265
272
  response.raise_for_status()
266
273
  return response.json()
@@ -268,25 +275,24 @@ class ReplicateApp(APIApplication):
268
275
  def deployments_delete(self, deployment_owner: str, deployment_name: str) -> str:
269
276
  """
270
277
  Deletes a specified deployment associated with a given owner or organization
271
-
278
+
272
279
  Args:
273
280
  deployment_owner: The username or organization name that owns the deployment
274
281
  deployment_name: The unique identifier/name of the deployment to be deleted
275
-
282
+
276
283
  Returns:
277
284
  A string containing a success message confirming the deployment deletion
278
-
285
+
279
286
  Raises:
280
287
  HTTPError: If the deletion request fails due to server error, invalid permissions, deployment being in use, or deployment not found
281
-
288
+
282
289
  Tags:
283
290
  delete, deployments, management, important, infrastructure, resource-management
284
291
  """
285
292
  url = f"{self.base_url}/deployments/{deployment_owner}/{deployment_name}"
286
293
  response = self._delete(url)
287
294
  response.raise_for_status()
288
- return f"Deployment '{deployment_owner}/{deployment_name}' deleted successfully." # Assuming 204 No Content
289
-
295
+ return f"Deployment '{deployment_owner}/{deployment_name}' deleted successfully." # Assuming 204 No Content
290
296
 
291
297
  # --- Deployments Predictions Operations ---
292
298
  # Note: The 'Prefer: wait' header is not directly supported by default _post.
@@ -297,13 +303,15 @@ class ReplicateApp(APIApplication):
297
303
  deployment_owner: str,
298
304
  deployment_name: str,
299
305
  input: dict[str, Any],
300
- stream: bool = None, # Deprecated according to schema
306
+ stream: bool = None, # Deprecated according to schema
301
307
  webhook: str = None,
302
- webhook_events_filter: list[Literal["start", "output", "logs", "completed"]] = None,
308
+ webhook_events_filter: list[
309
+ Literal["start", "output", "logs", "completed"]
310
+ ] = None,
303
311
  ) -> dict[str, Any]:
304
312
  """
305
313
  Creates an asynchronous prediction using a specified deployment, optionally configuring webhook notifications for status updates.
306
-
314
+
307
315
  Args:
308
316
  deployment_owner: The owner's username or organization name of the deployment
309
317
  deployment_name: The name of the deployment to use for prediction
@@ -311,21 +319,21 @@ class ReplicateApp(APIApplication):
311
319
  stream: Deprecated parameter for requesting streaming output URL
312
320
  webhook: HTTPS URL where prediction status updates will be sent
313
321
  webhook_events_filter: List of specific events to trigger webhook notifications ('start', 'output', 'logs', 'completed')
314
-
322
+
315
323
  Returns:
316
324
  Dictionary containing the initial prediction state, including a prediction ID for status polling
317
-
325
+
318
326
  Raises:
319
327
  HTTPError: When the API request fails or returns an error status code
320
328
  JSONDecodeError: When the API response contains invalid JSON
321
-
329
+
322
330
  Tags:
323
331
  create, predict, async, deployments, webhook, http-request, important
324
332
  """
325
333
  url = f"{self.base_url}/deployments/{deployment_owner}/{deployment_name}/predictions"
326
334
  request_body = {
327
335
  "input": input,
328
- "stream": stream, # Included for completeness, though deprecated
336
+ "stream": stream, # Included for completeness, though deprecated
329
337
  "webhook": webhook,
330
338
  "webhook_events_filter": webhook_events_filter,
331
339
  }
@@ -334,19 +342,18 @@ class ReplicateApp(APIApplication):
334
342
  response.raise_for_status()
335
343
  return response.json()
336
344
 
337
-
338
345
  # --- Hardware Operations ---
339
346
 
340
347
  def hardware_list(self) -> list[dict[str, Any]]:
341
348
  """
342
349
  Retrieves a list of available hardware options for running models.
343
-
350
+
344
351
  Returns:
345
352
  List[Dict[str, Any]]: A list of dictionaries, where each dictionary represents a hardware option containing 'name' and 'sku' keys.
346
-
353
+
347
354
  Raises:
348
355
  HTTPError: When the API request fails or returns a non-200 status code
349
-
356
+
350
357
  Tags:
351
358
  list, hardware, read, api, configuration, important
352
359
  """
@@ -355,20 +362,19 @@ class ReplicateApp(APIApplication):
355
362
  response.raise_for_status()
356
363
  return response.json()
357
364
 
358
-
359
365
  # --- Model Operations ---
360
366
 
361
367
  def models_list(self) -> dict[str, Any]:
362
368
  """
363
369
  Retrieves a paginated list of publicly available models from the Replicate API.
364
-
370
+
365
371
  Returns:
366
372
  Dict[str, Any]: A dictionary containing the paginated list of model objects with their metadata and configurations.
367
-
373
+
368
374
  Raises:
369
375
  HTTPError: When the API request fails or returns a non-200 status code
370
376
  RequestException: When there are network connectivity issues or other request-related problems
371
-
377
+
372
378
  Tags:
373
379
  list, models, read, api, fetch, important
374
380
  """
@@ -391,7 +397,7 @@ class ReplicateApp(APIApplication):
391
397
  ) -> dict[str, Any]:
392
398
  """
393
399
  Creates a new model in the system with specified parameters and metadata.
394
-
400
+
395
401
  Args:
396
402
  owner: The username or organization name that will own the model
397
403
  name: The name of the model (must be unique for the owner)
@@ -402,13 +408,13 @@ class ReplicateApp(APIApplication):
402
408
  github_url: Optional URL for the model's source code repository
403
409
  license_url: Optional URL for the model's license documentation
404
410
  paper_url: Optional URL for the associated research paper
405
-
411
+
406
412
  Returns:
407
413
  Dictionary containing the details and metadata of the newly created model
408
-
414
+
409
415
  Raises:
410
416
  HTTPError: Raised when the API request fails or returns an error status code
411
-
417
+
412
418
  Tags:
413
419
  create, models, management, api, important
414
420
  """
@@ -432,17 +438,17 @@ class ReplicateApp(APIApplication):
432
438
  def models_search(self, query: str) -> dict[str, Any]:
433
439
  """
434
440
  Searches for public models based on a provided query string
435
-
441
+
436
442
  Args:
437
443
  query: A string containing the search query to filter models
438
-
444
+
439
445
  Returns:
440
446
  A dictionary containing paginated search results with matching model objects
441
-
447
+
442
448
  Raises:
443
449
  Exception: When the HTTP request fails or encounters network/server errors
444
450
  HTTPStatusError: When the API returns a non-successful status code
445
-
451
+
446
452
  Tags:
447
453
  search, models, query, read, api, http, important
448
454
  """
@@ -457,24 +463,23 @@ class ReplicateApp(APIApplication):
457
463
  response.raise_for_status()
458
464
  return response.json()
459
465
  except Exception as e:
460
- logger.error(f"Error during models_search: {e}")
461
- raise
462
-
466
+ logger.error(f"Error during models_search: {e}")
467
+ raise
463
468
 
464
469
  def models_get(self, model_owner: str, model_name: str) -> dict[str, Any]:
465
470
  """
466
471
  Retrieves detailed information about a specific AI model by its owner and name
467
-
472
+
468
473
  Args:
469
474
  model_owner: The owner's username or organization name who owns the model
470
475
  model_name: The unique name identifier of the model
471
-
476
+
472
477
  Returns:
473
478
  A dictionary containing detailed model information, including its latest version and usage examples
474
-
479
+
475
480
  Raises:
476
481
  HTTPError: Raised when the API request fails, such as when the model doesn't exist or there are authentication issues
477
-
482
+
478
483
  Tags:
479
484
  get, read, models, api, metadata, important
480
485
  """
@@ -486,43 +491,42 @@ class ReplicateApp(APIApplication):
486
491
  def models_delete(self, model_owner: str, model_name: str) -> str:
487
492
  """
488
493
  Deletes a private model from the system, provided it has no existing versions.
489
-
494
+
490
495
  Args:
491
496
  model_owner: The owner's username or organization name of the model
492
497
  model_name: The name of the model to be deleted
493
-
498
+
494
499
  Returns:
495
500
  A success message string confirming the model deletion
496
-
501
+
497
502
  Raises:
498
503
  HTTPError: When deletion fails due to model being public, having existing versions, or other API restrictions
499
-
504
+
500
505
  Tags:
501
506
  delete, models, management, important, api, cleanup
502
507
  """
503
508
  url = f"{self.base_url}/models/{model_owner}/{model_name}"
504
509
  response = self._delete(url)
505
- response.raise_for_status() # Expecting 204 No Content
510
+ response.raise_for_status() # Expecting 204 No Content
506
511
  return f"Model '{model_owner}/{model_name}' deleted successfully."
507
512
 
508
-
509
513
  # --- Model Examples Operations ---
510
514
 
511
515
  def models_examples_list(self, model_owner: str, model_name: str) -> dict[str, Any]:
512
516
  """
513
517
  Retrieves a list of example predictions associated with a specific model.
514
-
518
+
515
519
  Args:
516
520
  model_owner: The owner's username or organization name of the model
517
521
  model_name: The name of the model to retrieve examples for
518
-
522
+
519
523
  Returns:
520
524
  A dictionary containing a paginated list of example prediction objects for the specified model
521
-
525
+
522
526
  Raises:
523
527
  HTTPError: When the API request fails or returns a non-200 status code
524
528
  RequestException: When there are network connectivity issues or API communication errors
525
-
529
+
526
530
  Tags:
527
531
  list, read, models, examples, api, pagination, prediction
528
532
  """
@@ -531,9 +535,8 @@ class ReplicateApp(APIApplication):
531
535
  response.raise_for_status()
532
536
  return response.json()
533
537
 
534
-
535
538
  # --- Model Predictions Operations ---
536
- # Note: The 'Prefer: wait' header is not directly supported by default _post.
539
+ # Note: The 'Prefer: wait' header is not directly supported by default _post.
537
540
  # The response will likely be 201 or 202, requiring polling via predictions_get.
538
541
 
539
542
  def models_predictions_create(
@@ -541,13 +544,15 @@ class ReplicateApp(APIApplication):
541
544
  model_owner: str,
542
545
  model_name: str,
543
546
  input: dict[str, Any],
544
- stream: bool = None, # Deprecated according to schema
547
+ stream: bool = None, # Deprecated according to schema
545
548
  webhook: str = None,
546
- webhook_events_filter: list[Literal["start", "output", "logs", "completed"]] = None,
549
+ webhook_events_filter: list[
550
+ Literal["start", "output", "logs", "completed"]
551
+ ] = None,
547
552
  ) -> dict[str, Any]:
548
553
  """
549
554
  Creates an asynchronous prediction request using a specified machine learning model.
550
-
555
+
551
556
  Args:
552
557
  model_owner: The owner's username or organization name
553
558
  model_name: The name of the model to use for prediction
@@ -555,20 +560,20 @@ class ReplicateApp(APIApplication):
555
560
  stream: DEPRECATED. Boolean flag to request a streaming output URL
556
561
  webhook: HTTPS URL for receiving prediction status updates and results
557
562
  webhook_events_filter: List of events to trigger webhook notifications ('start', 'output', 'logs', 'completed')
558
-
563
+
559
564
  Returns:
560
565
  Dictionary containing the initial prediction state and metadata. Includes prediction ID for status polling.
561
-
566
+
562
567
  Raises:
563
568
  HTTPError: Raised when the API request fails or returns an error status code
564
-
569
+
565
570
  Tags:
566
571
  predict, create, async, models, webhook, api, ml, important
567
572
  """
568
573
  url = f"{self.base_url}/models/{model_owner}/{model_name}/predictions"
569
574
  request_body = {
570
575
  "input": input,
571
- "stream": stream, # Included for completeness, though deprecated
576
+ "stream": stream, # Included for completeness, though deprecated
572
577
  "webhook": webhook,
573
578
  "webhook_events_filter": webhook_events_filter,
574
579
  }
@@ -577,49 +582,47 @@ class ReplicateApp(APIApplication):
577
582
  response.raise_for_status()
578
583
  return response.json()
579
584
 
580
-
581
585
  # --- Model Readme Operations ---
582
586
 
583
587
  def models_readme_get(self, model_owner: str, model_name: str) -> str:
584
588
  """
585
589
  Retrieves the README content for a specified model in Markdown format.
586
-
590
+
587
591
  Args:
588
592
  model_owner: The owner's username or organization name
589
593
  model_name: The name of the model
590
-
594
+
591
595
  Returns:
592
596
  A string containing the README content in Markdown format
593
-
597
+
594
598
  Raises:
595
599
  HTTPError: When the API request fails or returns a non-200 status code
596
600
  RequestException: When there are network connectivity issues or other request-related problems
597
-
601
+
598
602
  Tags:
599
603
  get, read, models, documentation, markdown, api, metadata
600
604
  """
601
605
  url = f"{self.base_url}/models/{model_owner}/{model_name}/readme"
602
606
  response = self._get(url)
603
607
  response.raise_for_status()
604
- return response.text # README is text/plain
605
-
608
+ return response.text # README is text/plain
606
609
 
607
610
  # --- Model Versions Operations ---
608
611
 
609
612
  def models_versions_list(self, model_owner: str, model_name: str) -> dict[str, Any]:
610
613
  """
611
614
  Lists all available versions of a specified model.
612
-
615
+
613
616
  Args:
614
617
  model_owner: The username or organization name that owns the model
615
618
  model_name: The name of the model whose versions are to be listed
616
-
619
+
617
620
  Returns:
618
621
  A dictionary containing a paginated list of model version objects with version details
619
-
622
+
620
623
  Raises:
621
624
  HTTPError: When the API request fails or returns a non-200 status code
622
-
625
+
623
626
  Tags:
624
627
  list, read, models, versions, api, management, paginated, important
625
628
  """
@@ -628,21 +631,23 @@ class ReplicateApp(APIApplication):
628
631
  response.raise_for_status()
629
632
  return response.json()
630
633
 
631
- def models_versions_get(self, model_owner: str, model_name: str, version_id: str) -> dict[str, Any]:
634
+ def models_versions_get(
635
+ self, model_owner: str, model_name: str, version_id: str
636
+ ) -> dict[str, Any]:
632
637
  """
633
638
  Retrieves detailed information about a specific version of a model by querying the API.
634
-
639
+
635
640
  Args:
636
641
  model_owner: The owner's username or organization name who owns the model
637
642
  model_name: The name of the model to query
638
643
  version_id: The unique identifier of the specific model version
639
-
644
+
640
645
  Returns:
641
646
  A dictionary containing detailed information about the model version, including its OpenAPI schema and metadata
642
-
647
+
643
648
  Raises:
644
649
  HTTPError: Raised when the API request fails, such as when the model version doesn't exist or there are authentication issues
645
-
650
+
646
651
  Tags:
647
652
  get, read, models, versions, api, metadata, important
648
653
  """
@@ -651,30 +656,31 @@ class ReplicateApp(APIApplication):
651
656
  response.raise_for_status()
652
657
  return response.json()
653
658
 
654
- def models_versions_delete(self, model_owner: str, model_name: str, version_id: str) -> str:
659
+ def models_versions_delete(
660
+ self, model_owner: str, model_name: str, version_id: str
661
+ ) -> str:
655
662
  """
656
663
  Deletes a specific version of a model and its associated predictions/output.
657
-
664
+
658
665
  Args:
659
666
  model_owner: The owner's username or organization name
660
667
  model_name: The name of the model
661
668
  version_id: The ID of the version to be deleted
662
-
669
+
663
670
  Returns:
664
671
  A success message confirming the deletion request was accepted
665
-
672
+
666
673
  Raises:
667
674
  HTTPError: If the deletion request fails due to API restrictions or permissions
668
-
675
+
669
676
  Tags:
670
677
  delete, models, versions, management, important
671
678
  """
672
679
  url = f"{self.base_url}/models/{model_owner}/{model_name}/versions/{version_id}"
673
680
  response = self._delete(url)
674
- response.raise_for_status() # Expecting 202 Accepted or 204 No Content
681
+ response.raise_for_status() # Expecting 202 Accepted or 204 No Content
675
682
  return f"Deletion request for version '{version_id}' of model '{model_owner}/{model_name}' accepted."
676
683
 
677
-
678
684
  # --- Training Operations (via Model Version) ---
679
685
 
680
686
  def trainings_create(
@@ -685,11 +691,13 @@ class ReplicateApp(APIApplication):
685
691
  destination: str,
686
692
  input: dict[str, Any],
687
693
  webhook: str = None,
688
- webhook_events_filter: list[Literal["start", "output", "logs", "completed"]] = None,
694
+ webhook_events_filter: list[
695
+ Literal["start", "output", "logs", "completed"]
696
+ ] = None,
689
697
  ) -> dict[str, Any]:
690
698
  """
691
699
  Initiates a new asynchronous training job for a specific model version, with optional webhook notifications for progress updates.
692
-
700
+
693
701
  Args:
694
702
  model_owner: The owner's username or organization name of the base model
695
703
  model_name: The name of the base model
@@ -698,13 +706,13 @@ class ReplicateApp(APIApplication):
698
706
  input: Dictionary containing inputs for the training function
699
707
  webhook: Optional HTTPS URL for receiving training updates
700
708
  webhook_events_filter: Optional list of events to trigger webhooks ('start', 'output', 'logs', 'completed')
701
-
709
+
702
710
  Returns:
703
711
  Dictionary containing the initial state of the training job
704
-
712
+
705
713
  Raises:
706
714
  HTTPError: Raised when the API request fails or returns an error status code
707
-
715
+
708
716
  Tags:
709
717
  training, create, async-job, start, model-management, webhook, important
710
718
  """
@@ -720,28 +728,27 @@ class ReplicateApp(APIApplication):
720
728
  response.raise_for_status()
721
729
  return response.json()
722
730
 
723
-
724
731
  # --- Prediction Operations ---
725
732
 
726
733
  def predictions_list(
727
734
  self,
728
- created_after: str = None, # ISO 8601 date-time
729
- created_before: str = None, # ISO 8601 date-time
735
+ created_after: str = None, # ISO 8601 date-time
736
+ created_before: str = None, # ISO 8601 date-time
730
737
  ) -> dict[str, Any]:
731
738
  """
732
739
  Lists all predictions created by the authenticated account within an optional time range.
733
-
740
+
734
741
  Args:
735
742
  created_after: ISO 8601 date-time string specifying the lower bound for prediction creation time (inclusive)
736
743
  created_before: ISO 8601 date-time string specifying the upper bound for prediction creation time (exclusive)
737
-
744
+
738
745
  Returns:
739
746
  Dictionary containing a paginated list of prediction objects with their associated metadata
740
-
747
+
741
748
  Raises:
742
749
  HTTPError: When the API request fails or returns a non-200 status code
743
750
  RequestException: When there are network connectivity issues or invalid request parameters
744
-
751
+
745
752
  Tags:
746
753
  list, read, predictions, query, filter, pagination, important
747
754
  """
@@ -762,26 +769,28 @@ class ReplicateApp(APIApplication):
762
769
  self,
763
770
  version: str,
764
771
  input: dict[str, Any],
765
- stream: bool = None, # Deprecated according to schema
772
+ stream: bool = None, # Deprecated according to schema
766
773
  webhook: str = None,
767
- webhook_events_filter: list[Literal["start", "output", "logs", "completed"]] = None,
774
+ webhook_events_filter: list[
775
+ Literal["start", "output", "logs", "completed"]
776
+ ] = None,
768
777
  ) -> dict[str, Any]:
769
778
  """
770
779
  Creates an asynchronous prediction request using a specified model version.
771
-
780
+
772
781
  Args:
773
782
  version: The ID of the model version to execute the prediction
774
783
  input: A dictionary containing the input data for the model prediction
775
784
  stream: Deprecated parameter - Previously used for requesting streaming output URL
776
785
  webhook: Optional HTTPS URL to receive prediction status updates and results
777
786
  webhook_events_filter: Optional list of event types to trigger webhook notifications. Valid events: 'start', 'output', 'logs', 'completed'
778
-
787
+
779
788
  Returns:
780
789
  A dictionary containing the initial prediction state, including a prediction ID for status tracking
781
-
790
+
782
791
  Raises:
783
792
  HTTPError: Raised when the API request fails or returns an error status code
784
-
793
+
785
794
  Tags:
786
795
  predictions, create, async, api, model, important, webhook, ml
787
796
  """
@@ -789,7 +798,7 @@ class ReplicateApp(APIApplication):
789
798
  request_body = {
790
799
  "version": version,
791
800
  "input": input,
792
- "stream": stream, # Included for completeness, though deprecated
801
+ "stream": stream, # Included for completeness, though deprecated
793
802
  "webhook": webhook,
794
803
  "webhook_events_filter": webhook_events_filter,
795
804
  }
@@ -798,21 +807,20 @@ class ReplicateApp(APIApplication):
798
807
  response.raise_for_status()
799
808
  return response.json()
800
809
 
801
-
802
810
  def predictions_get(self, prediction_id: str) -> dict[str, Any]:
803
811
  """
804
812
  Retrieves the current state and details of a prediction by its ID.
805
-
813
+
806
814
  Args:
807
815
  prediction_id: String identifier of the prediction to retrieve
808
-
816
+
809
817
  Returns:
810
818
  Dictionary containing the prediction's current state and associated details
811
-
819
+
812
820
  Raises:
813
821
  HTTPError: When the API request fails or returns a non-200 status code
814
822
  RequestException: When there are network connectivity issues or invalid URL
815
-
823
+
816
824
  Tags:
817
825
  get, read, status, predictions, retrieve, api, important
818
826
  """
@@ -821,26 +829,30 @@ class ReplicateApp(APIApplication):
821
829
  response.raise_for_status()
822
830
  return response.json()
823
831
 
824
- def predictions_cancel(self, prediction_id: str) -> str: # Schema shows no content for 200 success
832
+ def predictions_cancel(
833
+ self, prediction_id: str
834
+ ) -> str: # Schema shows no content for 200 success
825
835
  """
826
836
  Cancels a running prediction job identified by its ID.
827
-
837
+
828
838
  Args:
829
839
  prediction_id: The unique identifier of the prediction job to cancel
830
-
840
+
831
841
  Returns:
832
842
  A string message confirming successful cancellation of the prediction
833
-
843
+
834
844
  Raises:
835
845
  HTTPError: When the API request fails or returns an error status code
836
846
  RequestException: When there are network connectivity issues or other request-related problems
837
-
847
+
838
848
  Tags:
839
849
  cancel, predictions, management, api, async-job, important
840
850
  """
841
851
  url = f"{self.base_url}/predictions/{prediction_id}/cancel"
842
- response = self._post(url, data={}) # POST with empty body for cancel according to typical patterns
843
- response.raise_for_status() # Expecting 200 Success or similar
852
+ response = self._post(
853
+ url, data={}
854
+ ) # POST with empty body for cancel according to typical patterns
855
+ response.raise_for_status() # Expecting 200 Success or similar
844
856
  return f"Prediction '{prediction_id}' cancelled successfully."
845
857
 
846
858
  # --- Training Operations ---
@@ -848,14 +860,14 @@ class ReplicateApp(APIApplication):
848
860
  def trainings_list(self) -> dict[str, Any]:
849
861
  """
850
862
  Lists all training jobs created by the authenticated account.
851
-
863
+
852
864
  Returns:
853
865
  Dict[str, Any]: A dictionary containing a paginated list of training objects with their details and metadata.
854
-
866
+
855
867
  Raises:
856
868
  HTTPError: When the API request fails or returns a non-200 status code
857
869
  RequestException: When there's a network error or connection issue
858
-
870
+
859
871
  Tags:
860
872
  list, read, trainings, management, important
861
873
  """
@@ -867,16 +879,16 @@ class ReplicateApp(APIApplication):
867
879
  def trainings_get(self, training_id: str) -> dict[str, Any]:
868
880
  """
869
881
  Retrieves the current state of a training job by its ID.
870
-
882
+
871
883
  Args:
872
884
  training_id: A string identifier for the training job
873
-
885
+
874
886
  Returns:
875
887
  A dictionary containing the current state and details of the training job
876
-
888
+
877
889
  Raises:
878
890
  HTTPError: When the API request fails or returns a non-200 status code
879
-
891
+
880
892
  Tags:
881
893
  get, read, status, training, api, fetch, monitor, important
882
894
  """
@@ -888,22 +900,22 @@ class ReplicateApp(APIApplication):
888
900
  def trainings_cancel(self, training_id: str) -> dict[str, Any]:
889
901
  """
890
902
  Cancels a specific training job in progress.
891
-
903
+
892
904
  Args:
893
905
  training_id: String identifier of the training job to be cancelled
894
-
906
+
895
907
  Returns:
896
908
  Dictionary containing the updated state and details of the cancelled training job
897
-
909
+
898
910
  Raises:
899
911
  HTTPError: When the cancellation request fails or the server returns an error response
900
912
  RequestException: When network issues or connection problems occur during the API call
901
-
913
+
902
914
  Tags:
903
915
  cancel, trainings, management, async-job, important
904
916
  """
905
917
  url = f"{self.base_url}/trainings/{training_id}/cancel"
906
- response = self._post(url, data={}) # POST with empty body for cancel
918
+ response = self._post(url, data={}) # POST with empty body for cancel
907
919
  response.raise_for_status()
908
920
  return response.json()
909
921
 
@@ -912,14 +924,14 @@ class ReplicateApp(APIApplication):
912
924
  def webhooks_default_secret_get(self) -> dict[str, str]:
913
925
  """
914
926
  Retrieves the signing secret for the default webhook endpoint.
915
-
927
+
916
928
  Returns:
917
929
  Dict[str, str]: A dictionary containing the 'key' field with the signing secret value.
918
-
930
+
919
931
  Raises:
920
932
  HTTPError: If the API request fails or returns a non-200 status code.
921
933
  RequestException: If there are network connectivity issues or other request-related problems.
922
-
934
+
923
935
  Tags:
924
936
  get, read, webhooks, security, secret, authentication, api, important
925
937
  """
@@ -928,7 +940,6 @@ class ReplicateApp(APIApplication):
928
940
  response.raise_for_status()
929
941
  return response.json()
930
942
 
931
-
932
943
  # --- Required list_tools method ---
933
944
 
934
945
  def list_tools(self):
@@ -957,7 +968,7 @@ class ReplicateApp(APIApplication):
957
968
  self.models_versions_list,
958
969
  self.models_versions_get,
959
970
  self.models_versions_delete,
960
- self.trainings_create, # Training is started via model version path
971
+ self.trainings_create, # Training is started via model version path
961
972
  self.predictions_list,
962
973
  self.predictions_create,
963
974
  self.predictions_get,
@@ -966,4 +977,4 @@ class ReplicateApp(APIApplication):
966
977
  self.trainings_get,
967
978
  self.trainings_cancel,
968
979
  self.webhooks_default_secret_get,
969
- ]
980
+ ]