Skip to content

_status

GenerationKobold

Bases: Generation

Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
class GenerationKobold(Generation):
    id_: str | None = Field(default=None, title="Generation ID")
    """The ID for this generation."""
    gen_metadata: list[GenMetadataEntry] | None = None  # FIXME: API declares a `GenerationMetadataKobold` here
    """Extra metadata about faulted or defaulted components of the generation."""
    seed: int | None = Field(0, title="Generation Seed")
    """The seed which generated this text."""
    text: str | None = Field(default=None, min_length=0, title="Generated Text")
    """The generated text."""

    @override
    @classmethod
    def get_api_model_name(self) -> str | None:
        return "GenerationKobold"

    @field_validator("id_", mode="before")
    def validate_id(cls, v: str | JobID) -> JobID | str:
        if isinstance(v, str) and v == "":
            logger.warning("Job ID is empty")
            return JobID(root=uuid.uuid4())

        return v

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, GenerationKobold):
            return False
        return self.id_ == other.id_

    def __hash__(self) -> int:
        return hash(GenerationKobold.__name__) + hash(self.id_)

id_ class-attribute instance-attribute

id_: str | None = Field(default=None, title='Generation ID')

The ID for this generation.

gen_metadata class-attribute instance-attribute

gen_metadata: list[GenMetadataEntry] | None = None

Extra metadata about faulted or defaulted components of the generation.

seed class-attribute instance-attribute

seed: int | None = Field(0, title='Generation Seed')

The seed which generated this text.

text class-attribute instance-attribute

text: str | None = Field(default=None, min_length=0, title='Generated Text')

The generated text.

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_api_model_name(self) -> str | None:
    return "GenerationKobold"

validate_id

validate_id(v: str | JobID) -> JobID | str
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@field_validator("id_", mode="before")
def validate_id(cls, v: str | JobID) -> JobID | str:
    if isinstance(v, str) and v == "":
        logger.warning("Job ID is empty")
        return JobID(root=uuid.uuid4())

    return v

__eq__

__eq__(other: object) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
def __eq__(self, other: object) -> bool:
    if not isinstance(other, GenerationKobold):
        return False
    return self.id_ == other.id_

__hash__

__hash__() -> int
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
def __hash__(self) -> int:
    return hash(GenerationKobold.__name__) + hash(self.id_)

TextGenerateStatusResponse

Bases: HordeResponseBaseModel, ResponseWithProgressMixin, ResponseGenerationProgressInfoMixin

Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
class TextGenerateStatusResponse(
    HordeResponseBaseModel,
    ResponseWithProgressMixin,
    ResponseGenerationProgressInfoMixin,
):
    generations: list[GenerationKobold] = Field(
        default_factory=list,
        title="Generations",
    )
    """The generations that have been completed in this request."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "RequestStatusKobold"

    @override
    @classmethod
    def get_finalize_success_request_type(cls) -> None:
        return None

    @override
    def is_job_complete(self, number_of_result_expected: int) -> bool:
        return len(self.generations) == number_of_result_expected

    @override
    def is_job_possible(self) -> bool:
        return self.is_possible

    @override
    @classmethod
    def is_final_follow_up(cls) -> bool:
        return True

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, TextGenerateStatusResponse):
            return False
        return all(gen in other.generations for gen in self.generations)

    def __hash__(self) -> int:
        return hash(tuple(self.generations))

generations class-attribute instance-attribute

generations: list[GenerationKobold] = Field(default_factory=list, title='Generations')

The generations that have been completed in this request.

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "RequestStatusKobold"

get_finalize_success_request_type classmethod

get_finalize_success_request_type() -> None
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_finalize_success_request_type(cls) -> None:
    return None

is_job_complete

is_job_complete(number_of_result_expected: int) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
def is_job_complete(self, number_of_result_expected: int) -> bool:
    return len(self.generations) == number_of_result_expected

is_job_possible

is_job_possible() -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
def is_job_possible(self) -> bool:
    return self.is_possible

is_final_follow_up classmethod

is_final_follow_up() -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def is_final_follow_up(cls) -> bool:
    return True

__eq__

__eq__(other: object) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
def __eq__(self, other: object) -> bool:
    if not isinstance(other, TextGenerateStatusResponse):
        return False
    return all(gen in other.generations for gen in self.generations)

__hash__

__hash__() -> int
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
def __hash__(self) -> int:
    return hash(tuple(self.generations))

DeleteTextGenerateRequest

Bases: BaseAIHordeRequest, JobRequestMixin

Represents a DELETE request to the /v2/generate/text/status/{id} endpoint.

Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
class DeleteTextGenerateRequest(
    BaseAIHordeRequest,
    JobRequestMixin,
):
    """Represents a DELETE request to the `/v2/generate/text/status/{id}` endpoint."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return None

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.DELETE

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_generate_text_status

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[TextGenerateStatusResponse]:
        return TextGenerateStatusResponse

    @override
    def __eq__(self, value: object) -> bool:
        if not isinstance(value, DeleteTextGenerateRequest):
            return False

        return self.id_ == value.id_

    @override
    def __hash__(self) -> int:
        return hash(DeleteTextGenerateRequest.__name__) + hash(self.id_)

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return None

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.DELETE

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_generate_text_status

get_default_success_response_type classmethod

get_default_success_response_type() -> type[TextGenerateStatusResponse]
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[TextGenerateStatusResponse]:
    return TextGenerateStatusResponse

__eq__

__eq__(value: object) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
def __eq__(self, value: object) -> bool:
    if not isinstance(value, DeleteTextGenerateRequest):
        return False

    return self.id_ == value.id_

__hash__

__hash__() -> int
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
def __hash__(self) -> int:
    return hash(DeleteTextGenerateRequest.__name__) + hash(self.id_)

TextGenerateStatusRequest

Bases: BaseAIHordeRequest, JobRequestMixin

Represents a GET request to the /v2/generate/status/{id} endpoint.

Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
class TextGenerateStatusRequest(BaseAIHordeRequest, JobRequestMixin):
    """Represents a GET request to the `/v2/generate/status/{id}` endpoint."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return None

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.GET

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_generate_text_status

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[TextGenerateStatusResponse]:
        return TextGenerateStatusResponse

    @override
    def __eq__(self, value: object) -> bool:
        if not isinstance(value, TextGenerateStatusRequest):
            return False

        return self.id_ == value.id_

    @override
    def __hash__(self) -> int:
        return hash(TextGenerateStatusRequest.__name__) + hash(self.id_)

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return None

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.GET

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_generate_text_status

get_default_success_response_type classmethod

get_default_success_response_type() -> type[TextGenerateStatusResponse]
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[TextGenerateStatusResponse]:
    return TextGenerateStatusResponse

__eq__

__eq__(value: object) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
def __eq__(self, value: object) -> bool:
    if not isinstance(value, TextGenerateStatusRequest):
        return False

    return self.id_ == value.id_

__hash__

__hash__() -> int
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/_status.py
@override
def __hash__(self) -> int:
    return hash(TextGenerateStatusRequest.__name__) + hash(self.id_)