async_
TextGenerateAsyncResponse
Bases: HordeResponseBaseModel, JobResponseMixin, ResponseRequiringFollowUpMixin, ContainsMessageResponseMixin
The expected cost of the requested job and any warnings generated by the server.
Represents the data returned from the /v2/generate/text/async endpoint with http status code 202.
v2 API Model: RequestAsync
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/async_.py
kudos
class-attribute
instance-attribute
The expected kudos consumption for this request.
warnings
class-attribute
instance-attribute
Any warnings that were generated by the server or a serving worker.
model_config
class-attribute
instance-attribute
message
class-attribute
instance-attribute
A message from the API. This is typically an error or warning message, but may also be informational.
time_constructed
property
The time the model was constructed (in epoch time).
validate_warnings
Log any warnings that were generated by the server or a serving worker.
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/async_.py
get_follow_up_returned_params
get_follow_up_default_request_type
classmethod
get_follow_up_request_types
classmethod
get_follow_up_failure_cleanup_request_type
classmethod
get_api_model_name
classmethod
__hash__
__eq__
get_follow_up_extra_params
Return any additional information required from this response to submit a follow up request.
Source code in horde_sdk/generic_api/apimodels.py
get_follow_up_all_params
Return the required inf from this response to submit any follow up requests warranted from this response.
Note that this dict uses the alias field names (as seen on the API), not the python field names.
get_follow_up_failure_cleanup_params is not included.
This is used for context management.
Returns:
-
list[dict[str, object]]–list[dict[str, object]]: A list of dicts of parameter names and values for each follow up request.
Source code in horde_sdk/generic_api/apimodels.py
get_follow_up_failure_cleanup_params
Return any extra information required from this response to clean up after a failed follow up request.
Note that this dict uses the alias field names (as seen on the API), not the python field names.
This is used for context management.
Source code in horde_sdk/generic_api/apimodels.py
get_follow_up_failure_cleanup_request
Return the request for this response to clean up after a failed follow up request.
Source code in horde_sdk/generic_api/apimodels.py
ignore_failure
Return if the object is in a state which doesn't require failure follow up.
does_target_request_follow_up
Return whether the target_request would follow up on this request.
Parameters:
-
target_request(HordeRequest) –The request to check if it would follow up on this request.
Returns:
-
bool(bool) –Whether the
target_requestwould follow up on this request.
Source code in horde_sdk/generic_api/apimodels.py
validate_id
Ensure that the job ID is not empty.
Source code in horde_sdk/ai_horde_api/apimodels/base.py
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
ModelPayloadRootKobold
Bases: _BasePayloadKoboldMixin
Base model for KoboldAI generation payloads.
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/async_.py
n
class-attribute
instance-attribute
The number of generations to produce.
max_length
class-attribute
instance-attribute
Number of tokens to generate.
max_context_length
class-attribute
instance-attribute
Maximum number of tokens to send to the model.
model_config
class-attribute
instance-attribute
dynatemp_exponent
class-attribute
instance-attribute
Dynamic temperature exponent value.
dynatemp_range
class-attribute
instance-attribute
Dynamic temperature range value.
frmtadsnsp
class-attribute
instance-attribute
frmtadsnsp: bool | None = Field(
default=None,
description="Input formatting option. When enabled, adds a leading space to your input if there is no trailing whitespace at the end of the previous action.",
examples=[False],
)
Input formatting option. When enabled, adds a leading space to your input if there is no trailing whitespace at the end of the previous action.
frmtrmblln
class-attribute
instance-attribute
frmtrmblln: bool | None = Field(
default=None,
description="Output formatting option. When enabled, replaces all occurrences of two or more consecutive newlines in the output with one newline.",
examples=[False],
)
Output formatting option. When enabled, replaces all occurrences of two or more consecutive newlines in the output with one newline.
frmtrmspch
class-attribute
instance-attribute
Output formatting option. When enabled, removes #/@%}{+=~|\^<> from the output.
frmttriminc
class-attribute
instance-attribute
frmttriminc: bool | None = Field(
default=None,
description="Output formatting option. When enabled, removes some characters from the end of the output such that the output doesn't end in the middle of a sentence. If the output is less than one sentence long, does nothing.",
examples=[False],
)
Output formatting option. When enabled, removes some characters from the end of the output such that the output doesn't end in the middle of a sentence. If the output is less than one sentence long, does nothing.
min_p
class-attribute
instance-attribute
Min-p sampling value.
rep_pen
class-attribute
instance-attribute
Base repetition penalty value.
rep_pen_range
class-attribute
instance-attribute
Repetition penalty range.
rep_pen_slope
class-attribute
instance-attribute
Repetition penalty slope.
sampler_order
class-attribute
instance-attribute
The sampler order to use for the generation.
singleline
class-attribute
instance-attribute
singleline: bool | None = Field(
default=None,
description="Output formatting option. When enabled, removes everything after the first line of the output, including the newline.",
examples=[False],
)
Output formatting option. When enabled, removes everything after the first line of the output, including the newline.
smoothing_factor
class-attribute
instance-attribute
Quadratic sampling value.
stop_sequence
class-attribute
instance-attribute
The stop sequences to use for the generation.
temperature
class-attribute
instance-attribute
Temperature value.
tfs
class-attribute
instance-attribute
Tail free sampling value.
top_a
class-attribute
instance-attribute
Top-a sampling value.
top_k
class-attribute
instance-attribute
Top-k sampling value.
top_p
class-attribute
instance-attribute
Top-p sampling value.
typical
class-attribute
instance-attribute
Typical sampling value.
ModelGenerationInputKobold
Bases: ModelPayloadRootKobold
API Parity intermediate model for generation input.
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/async_.py
model_config
class-attribute
instance-attribute
dynatemp_exponent
class-attribute
instance-attribute
Dynamic temperature exponent value.
dynatemp_range
class-attribute
instance-attribute
Dynamic temperature range value.
frmtadsnsp
class-attribute
instance-attribute
frmtadsnsp: bool | None = Field(
default=None,
description="Input formatting option. When enabled, adds a leading space to your input if there is no trailing whitespace at the end of the previous action.",
examples=[False],
)
Input formatting option. When enabled, adds a leading space to your input if there is no trailing whitespace at the end of the previous action.
frmtrmblln
class-attribute
instance-attribute
frmtrmblln: bool | None = Field(
default=None,
description="Output formatting option. When enabled, replaces all occurrences of two or more consecutive newlines in the output with one newline.",
examples=[False],
)
Output formatting option. When enabled, replaces all occurrences of two or more consecutive newlines in the output with one newline.
frmtrmspch
class-attribute
instance-attribute
Output formatting option. When enabled, removes #/@%}{+=~|\^<> from the output.
frmttriminc
class-attribute
instance-attribute
frmttriminc: bool | None = Field(
default=None,
description="Output formatting option. When enabled, removes some characters from the end of the output such that the output doesn't end in the middle of a sentence. If the output is less than one sentence long, does nothing.",
examples=[False],
)
Output formatting option. When enabled, removes some characters from the end of the output such that the output doesn't end in the middle of a sentence. If the output is less than one sentence long, does nothing.
min_p
class-attribute
instance-attribute
Min-p sampling value.
rep_pen
class-attribute
instance-attribute
Base repetition penalty value.
rep_pen_range
class-attribute
instance-attribute
Repetition penalty range.
rep_pen_slope
class-attribute
instance-attribute
Repetition penalty slope.
sampler_order
class-attribute
instance-attribute
The sampler order to use for the generation.
singleline
class-attribute
instance-attribute
singleline: bool | None = Field(
default=None,
description="Output formatting option. When enabled, removes everything after the first line of the output, including the newline.",
examples=[False],
)
Output formatting option. When enabled, removes everything after the first line of the output, including the newline.
smoothing_factor
class-attribute
instance-attribute
Quadratic sampling value.
stop_sequence
class-attribute
instance-attribute
The stop sequences to use for the generation.
temperature
class-attribute
instance-attribute
Temperature value.
tfs
class-attribute
instance-attribute
Tail free sampling value.
top_a
class-attribute
instance-attribute
Top-a sampling value.
top_k
class-attribute
instance-attribute
Top-k sampling value.
top_p
class-attribute
instance-attribute
Top-p sampling value.
typical
class-attribute
instance-attribute
Typical sampling value.
use_default_badwordsids
class-attribute
instance-attribute
When True, uses the default KoboldAI bad word IDs.
n
class-attribute
instance-attribute
The number of generations to produce.
max_length
class-attribute
instance-attribute
Number of tokens to generate.
TextGenerateAsyncDryRunResponse
Bases: HordeResponseBaseModel
Represents the data returned from the /v2/generate/text/async endpoint with http status code 200.
v2 API Model: _ANONYMOUS_MODEL
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/async_.py
time_constructed
property
The time the model was constructed (in epoch time).
model_config
class-attribute
instance-attribute
get_api_model_name
classmethod
get_sensitive_fields
classmethod
get_extra_fields_to_exclude_from_log
Return an additional set of fields to exclude from the log_safe_model_dump method.
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
TextGenerateAsyncRequest
Bases: BaseAIHordeRequest, APIKeyAllowedInRequestMixin, RequestUsesWorkerMixin
Represents a POST request to the /v2/generate/text/async endpoint.
v2 API Model: GenerationInputKobold
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/async_.py
params
class-attribute
instance-attribute
The parameters to use for the generation.
prompt
class-attribute
instance-attribute
The prompt which will be sent to KoboldAI to generate text.
extra_source_images
class-attribute
instance-attribute
Any extra source images that should be used for this request; e.g., for multi-modal models.
proxied_account
class-attribute
instance-attribute
If using a service account as a proxy, provide this value to identify the actual account from which this request is coming from.
softprompt
class-attribute
instance-attribute
Specify which softprompt needs to be used to service this request.
model_config
class-attribute
instance-attribute
trusted_workers
class-attribute
instance-attribute
When true, only trusted workers will serve this request. When False, Evaluating workers will also be used which can increase speed but adds more risk!
slow_workers
class-attribute
instance-attribute
When True, allows slower workers to pick up this request. Disabling this incurs an extra kudos cost.
extra_slow_workers
class-attribute
instance-attribute
When True, allows extra slow workers to pick up this request.
workers
class-attribute
instance-attribute
A list of worker IDs to use for this request. If empty, any worker can pick up the request. Using this incurs and extra kudos cost.
worker_blacklist
class-attribute
instance-attribute
If true, the worker list will be treated as a blacklist instead of a whitelist.
validated_backends
class-attribute
instance-attribute
When true, only inference backends that are validated by the AI Horde devs will serve this request. When False, non-validated backends will also be used which can increase speed but you may end up with unexpected results.
style
class-attribute
instance-attribute
The style ID to use for the generation.
dry_run
class-attribute
instance-attribute
If true, the request will not be processed, but will return a response with the estimated kudos cost.
webhook
class-attribute
instance-attribute
Provide a URL where the AI Horde will send a POST call after each delivered generation. The request will include the details of the job as well as the request ID.
allow_downgrade
class-attribute
instance-attribute
If true, the request can be modified to lesser parameters if the original request is too expensive.
disable_batching
class-attribute
instance-attribute
When true, This request will not use batching. This will allow you to retrieve accurate seeds. Feature is restricted to Trusted users and Patreons.
apikey
class-attribute
instance-attribute
Defaults to ANON_API_KEY. See also .is_api_key_required()
accept
class-attribute
instance-attribute
The 'accept' header field.
client_agent
class-attribute
instance-attribute
The requesting client's agent. You should set this to reflect the name, version and contact information for your client.
get_api_model_name
classmethod
get_http_method
classmethod
get_api_endpoint_subpath
classmethod
get_default_success_response_type
classmethod
get_success_status_response_pairs
classmethod
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/async_.py
get_extra_fields_to_exclude_from_log
get_sensitive_fields
classmethod
log_safe_model_dump
Return a dict of the model's fields, with any sensitive fields redacted.
Source code in horde_sdk/generic_api/apimodels.py
is_api_key_required
classmethod
validate_api_key_length
Validate that the API key is the correct length, or is the special ANON_API_KEY.
Source code in horde_sdk/generic_api/apimodels.py
get_api_endpoint_url
classmethod
Return the endpoint URL, including the path to the specific API action defined by this object.
Source code in horde_sdk/generic_api/apimodels.py
get_api_url
classmethod
get_header_fields
classmethod
Return a list of field names from this request object that should be sent as header fields.
This is in addition to GenericHeaderFields's values, and possibly the API specific class
which inherits from GenericHeaderFields, typically found in the horde_sdk.<api_name>_api.metadata module.
Source code in horde_sdk/generic_api/apimodels.py
get_query_fields
classmethod
Return a list of field names from this request object that should be sent as query parameters.
This is in addition to GenericQueryFields's values, and possibly the API specific class
which inherits from GenericQueryFields, typically found in the horde_sdk.<api_name>_api.metadata module.
Source code in horde_sdk/generic_api/apimodels.py
get_number_of_results_expected
Return the number of (job) results expected from this request.
Defaults to 1, but may be overridden to dynamically change the number of results expected.
This is factored into context management; if the number of results expected is not met, the job is considered unhandled on an exception and followed up on to attempt to close it.
Source code in horde_sdk/generic_api/apimodels.py
get_requires_follow_up
Return whether this request requires a follow up request(s).
Returns:
-
bool(bool) –Whether this request requires a follow up request to close the job on the server.