Skip to main content
Version: 1.0

aixplain.modules.pipeline.response

PipelineResponse Objects

@dataclass
class PipelineResponse()

[view_source]

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:

  • status ResponseStatus - The status of the pipeline operation.
  • error Optional[Dict[str, Any]] - Error details if operation failed.
  • elapsed_time Optional[float] - Time taken to complete the operation.
  • data Optional[Text] - The main response data.
  • url Optional[Text] - URL for polling or accessing results.
  • additional_fields Dict[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)

[view_source]

Initialize a new PipelineResponse instance.

Arguments:

  • status ResponseStatus - The status of the pipeline operation.
  • error Optional[Dict[str, Any]], optional - Error details if operation failed. Defaults to None.
  • elapsed_time Optional[float], optional - Time taken to complete the operation in seconds. Defaults to 0.0.
  • data Optional[Text], optional - The main response data. Defaults to None.
  • url Optional[Text], optional - URL for polling or accessing results. Defaults to "".
  • **kwargs - Additional fields to store in the response.

__getattr__

def __getattr__(key: str) -> Any

[view_source]

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:

  • key str - 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

[view_source]

Get an attribute value with a default if not found.

Arguments:

  • key str - The name of the attribute to get.
  • default Any, 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

[view_source]

Get an attribute value using dictionary-style access.

This method enables dictionary-style access to attributes (e.g., response["status"]).

Arguments:

  • key str - The name of the attribute to get.

Returns:

  • Any - The attribute value.

Raises:

  • AttributeError - If the key is not found.

__repr__

def __repr__() -> str

[view_source]

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

[view_source]

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:

  • key str - The name of the attribute to check.

Returns:

  • bool - True if the attribute exists, False otherwise.