Skip to content

progress

ResponseGenerationProgressInfoMixin

Bases: HordeAPIObjectBaseModel

A mixin for responses that contain information about the progress of a generation request.

Source code in horde_sdk/ai_horde_api/apimodels/generate/progress.py
class ResponseGenerationProgressInfoMixin(HordeAPIObjectBaseModel):
    """A mixin for responses that contain information about the progress of a generation request."""

    finished: int
    """The amount of finished jobs in this request."""
    processing: int
    """The amount of still processing jobs in this request."""
    restarted: int
    """The amount of jobs that timed out and had to be restarted or were reported as failed by a worker."""
    waiting: int
    """The amount of jobs waiting to be picked up by a worker."""
    done: bool
    """True when all jobs in this request are done. Else False."""
    faulted: bool = False
    """True when this request caused an internal server error and could not be completed."""
    wait_time: int
    """The expected amount to wait (in seconds) to generate all jobs in this request."""
    queue_position: int
    """The position in the requests queue. This position is determined by relative Kudos amounts."""
    kudos: float
    """The amount of total Kudos this request has consumed until now."""
    is_possible: bool = True
    """If False, this request will not be able to be completed with the pool of workers currently available."""

finished instance-attribute

finished: int

The amount of finished jobs in this request.

processing instance-attribute

processing: int

The amount of still processing jobs in this request.

restarted instance-attribute

restarted: int

The amount of jobs that timed out and had to be restarted or were reported as failed by a worker.

waiting instance-attribute

waiting: int

The amount of jobs waiting to be picked up by a worker.

done instance-attribute

done: bool

True when all jobs in this request are done. Else False.

faulted class-attribute instance-attribute

faulted: bool = False

True when this request caused an internal server error and could not be completed.

wait_time instance-attribute

wait_time: int

The expected amount to wait (in seconds) to generate all jobs in this request.

queue_position instance-attribute

queue_position: int

The position in the requests queue. This position is determined by relative Kudos amounts.

kudos instance-attribute

kudos: float

The amount of total Kudos this request has consumed until now.

is_possible class-attribute instance-attribute

is_possible: bool = True

If False, this request will not be able to be completed with the pool of workers currently available.

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

get_api_model_name abstractmethod classmethod

get_api_model_name() -> str | None

Return the name of the model as seen in the published swagger doc.

If none, there is no payload, such as for a GET request.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
@abc.abstractmethod
def get_api_model_name(cls) -> str | None:
    """Return the name of the model as seen in the published swagger doc.

    If none, there is no payload, such as for a GET request.
    """

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

ResponseGenerationProgressCombinedMixin

Bases: ResponseWithProgressMixin, ResponseGenerationProgressInfoMixin

A mixin for responses which provide progress and detailed information about a generation.

Source code in horde_sdk/ai_horde_api/apimodels/generate/progress.py
class ResponseGenerationProgressCombinedMixin(ResponseWithProgressMixin, ResponseGenerationProgressInfoMixin):
    """A mixin for responses which provide progress and detailed information about a generation."""

model_config class-attribute instance-attribute

model_config = get_default_frozen_model_config_dict()

finished instance-attribute

finished: int

The amount of finished jobs in this request.

processing instance-attribute

processing: int

The amount of still processing jobs in this request.

restarted instance-attribute

restarted: int

The amount of jobs that timed out and had to be restarted or were reported as failed by a worker.

waiting instance-attribute

waiting: int

The amount of jobs waiting to be picked up by a worker.

done instance-attribute

done: bool

True when all jobs in this request are done. Else False.

faulted class-attribute instance-attribute

faulted: bool = False

True when this request caused an internal server error and could not be completed.

wait_time instance-attribute

wait_time: int

The expected amount to wait (in seconds) to generate all jobs in this request.

queue_position instance-attribute

queue_position: int

The position in the requests queue. This position is determined by relative Kudos amounts.

kudos instance-attribute

kudos: float

The amount of total Kudos this request has consumed until now.

is_possible class-attribute instance-attribute

is_possible: bool = True

If False, this request will not be able to be completed with the pool of workers currently available.

get_api_model_name abstractmethod classmethod

get_api_model_name() -> str | None

Return the name of the model as seen in the published swagger doc.

If none, there is no payload, such as for a GET request.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
@abc.abstractmethod
def get_api_model_name(cls) -> str | None:
    """Return the name of the model as seen in the published swagger doc.

    If none, there is no payload, such as for a GET request.
    """

get_sensitive_fields classmethod

get_sensitive_fields() -> set[str]

Return a set of fields which should be redacted from logs.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def get_sensitive_fields(cls) -> set[str]:
    """Return a set of fields which should be redacted from logs."""
    return {"apikey"}

get_extra_fields_to_exclude_from_log

get_extra_fields_to_exclude_from_log() -> set[str]

Return an additional set of fields to exclude from the log_safe_model_dump method.

Source code in horde_sdk/generic_api/apimodels.py
def get_extra_fields_to_exclude_from_log(self) -> set[str]:
    """Return an additional set of fields to exclude from the log_safe_model_dump method."""
    return set()

log_safe_model_dump

log_safe_model_dump(
    extra_exclude: set[str] | None = None,
) -> dict[Any, Any]

Return a dict of the model's fields, with any sensitive fields redacted.

Source code in horde_sdk/generic_api/apimodels.py
def log_safe_model_dump(self, extra_exclude: set[str] | None = None) -> dict[Any, Any]:
    """Return a dict of the model's fields, with any sensitive fields redacted."""
    if extra_exclude is None:
        extra_exclude = set()

    if hasattr(self, "model_dump"):
        return self.model_dump(  # type: ignore
            exclude=self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude,
        )

    logger.warning("Model does not have a model_dump method. Using python native class compatible method.")
    logger.debug(
        "Generally this should not be relied upon. If you're seeing this and you're a developer for the SDK, "
        "consider using pydantic models instead.",
    )
    # Its not a pydantic model, use python native class compatible method
    return {
        key: getattr(self, key)
        for key in self.__dict__
        if key not in self.get_sensitive_fields() | self.get_extra_fields_to_exclude_from_log() | extra_exclude
    }

is_job_complete abstractmethod

is_job_complete(number_of_result_expected: int) -> bool

Return whether the job is complete.

Parameters:

  • number_of_result_expected (int) –

    The number of results expected from the job.

Returns:

  • bool ( bool ) –

    Whether the job is complete.

Source code in horde_sdk/generic_api/apimodels.py
@abc.abstractmethod
def is_job_complete(self, number_of_result_expected: int) -> bool:
    """Return whether the job is complete.

    Args:
        number_of_result_expected (int): The number of results expected from the job.

    Returns:
        bool: Whether the job is complete.
    """

is_job_possible abstractmethod

is_job_possible() -> bool

Return whether the job is possible.

Returns:

  • bool ( bool ) –

    Whether the job is possible.

Source code in horde_sdk/generic_api/apimodels.py
@abc.abstractmethod
def is_job_possible(self) -> bool:
    """Return whether the job is possible.

    Returns:
        bool: Whether the job is possible.
    """

is_final_follow_up classmethod

is_final_follow_up() -> bool

Return whether this response is the final follow up response.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
def is_final_follow_up(cls) -> bool:
    """Return whether this response is the final follow up response."""
    return False

get_finalize_success_request_type abstractmethod classmethod

get_finalize_success_request_type() -> (
    type[HordeRequest] | None
)

Return the request type for this response to finalize the job on success, or None if not needed.

Source code in horde_sdk/generic_api/apimodels.py
@classmethod
@abc.abstractmethod
def get_finalize_success_request_type(cls) -> type[HordeRequest] | None:
    """Return the request type for this response to finalize the job on success, or `None` if not needed."""