API Reference
Client
garden_ai.GardenClient
Main class for interacting with the Garden service.
Provides public get_garden method, and handles authentication with Globus Auth.
garden_ai.GardenClient.get_garden
get_garden(doi: str) -> Garden
Return the published Garden associated with the given DOI.
Parameters:
doi: The DOI of the garden. Raises an exception if not found.
Returns:
The published Garden object. Any Modal functions in the garden can be called like methods on this object.
Garden objects
garden_ai.gardens.Garden
Represents a collection of related functions, providing a way to organize and invoke machine learning models.
This class is geared towards users wishing to access a published Garden, and is meant to be instantiated by the client's get_garden method.
Attributes:
| Name | Type | Description |
|---|---|---|
metadata |
GardenMetadata
|
The Garden's published metadata, including information such as title, authors, description, and DOI. |
modal_functions |
list[ModalFunction]
|
The callable functions associated with this Garden. Individual functions are also accessible like attributes on this object. |
Example
Functions can be accessed as attributes of the Garden instance, allowing for intuitive calling of the associated functions:
garden_ai.gardens.Garden.get_job_status
Get status information for a submitted HPC job.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id |
str
|
Globus Compute task ID returned by HpcFunction.submit() |
required |
Returns:
| Type | Description |
|---|---|
JobStatus
|
JobStatus object with current status and outputs |
Example
status = garden.get_job_status(job_id)
print(status.status) # "completed"
if status.status == "completed":
... results = garden.get_results(job_id)
garden_ai.gardens.Garden.get_results
Retrieve results from a completed HPC job.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id |
str
|
Globus Compute task ID |
required |
output_path |
str | Path | None
|
Optional local path to save results (for file-based results) |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
Job results (type depends on the function) |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If job is not completed or failed |
Example
results = garden.get_results(job_id)
Or save to file:
results = garden.get_results(job_id, output_path="./results.xyz")
garden_ai.gardens.GardenMetadata
Represents the metadata defining a Garden.
Not meant to be instantiated directly by users. Instead, new Gardens should be created via the CLI or web UI
Attributes:
| Name | Type | Description |
|---|---|---|
doi |
str
|
The Digital Object Identifier (DOI) for the Garden. |
title |
str
|
The title of the Garden. |
authors |
UniqueList[str]
|
A list of authors of the Garden. |
contributors |
UniqueList[str]
|
A list of contributors to the Garden. Defaults to an empty list. |
doi_is_draft |
bool | None
|
Indicates if the DOI is in draft status. Defaults to True. |
description |
str | None
|
A brief description of the Garden. Defaults to None. |
publisher |
str
|
The publisher of the Garden. Defaults to "Garden-AI". |
year |
str
|
The year of publication. Defaults to the current year. |
language |
str
|
The primary language of the Garden. Defaults to "en" (English). |
tags |
UniqueList[str]
|
A list of tags associated with the Garden. Defaults to an empty list. |
version |
str
|
The version of the Garden. Defaults to "0.0.1". |
owner_identity_id |
UUID | None
|
The UUID of the Garden's owner. Defaults to None. |
id |
int | None
|
An internal identifier for the Garden. Defaults to None. |