aixplain.modules.pipeline.response
PipelineResponse Objects
@dataclass
class PipelineResponse()
A response object for pipeline operations.
This class encapsulates the response from pipeline operations, including status, error information, timing data, and any additional fields.
Attributes:
statusResponseStatus - The status of the pipeline operation.errorOptional[Dict[str, Any]] - Error details if operation failed.elapsed_timeOptional[float] - Time taken to complete the operation.dataOptional[Text] - The main response data.urlOptional[Text] - URL for polling or accessing results.additional_fieldsDict[str, Any] - Any extra fields provided.
__init__
def __init__(status: ResponseStatus,
error: Optional[Dict[str, Any]] = None,
elapsed_time: Optional[float] = 0.0,
data: Optional[Text] = None,
url: Optional[Text] = "",
**kwargs)
Initialize a new PipelineResponse instance.
Arguments:
statusResponseStatus - The status of the pipeline operation.errorOptional[Dict[str, Any]], optional - Error details if operation failed. Defaults to None.elapsed_timeOptional[float], optional - Time taken to complete the operation in seconds. Defaults to 0.0.dataOptional[Text], optional - The main response data. Defaults to None.urlOptional[Text], optional - URL for polling or accessing results. Defaults to "".**kwargs- Additional fields to store in the response.
__getattr__
def __getattr__(key: str) -> Any
Get an attribute from additional_fields if it exists.
This method is called when an attribute lookup has not found the attribute in the usual places (i.e., it is not an instance attribute nor found through the mro chain).
Arguments:
keystr - The name of the attribute to get.
Returns:
Any- The value from additional_fields.
Raises:
AttributeError- If the key is not found in additional_fields.
get
def get(key: str, default: Any = None) -> Any
Get an attribute value with a default if not found.
Arguments:
keystr - The name of the attribute to get.defaultAny, optional - Value to return if key is not found. Defaults to None.
Returns:
Any- The attribute value or default if not found.
__getitem__
def __getitem__(key: str) -> Any
Get an attribute value using dictionary-style access.
This method enables dictionary-style access to attributes (e.g., response["status"]).
Arguments:
keystr - The name of the attribute to get.
Returns:
Any- The attribute value.
Raises:
AttributeError- If the key is not found.
__repr__
def __repr__() -> str
Return a string representation of the PipelineResponse.
Returns:
str- A string in the format "PipelineResponse(status=X, error=Y, ...)" containing all non-empty fields.
__contains__
def __contains__(key: str) -> bool
Check if an attribute exists using 'in' operator.
This method enables using the 'in' operator to check for attribute existence (e.g., "status" in response).
Arguments:
keystr - The name of the attribute to check.
Returns:
bool- True if the attribute exists, False otherwise.