pop
ModelPayloadKobold
Bases: ModelPayloadRootKobold
Mixin for the model payload for Kobold.
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/pop.py
prompt
class-attribute
instance-attribute
The prompt for the text generation.
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.
NoValidRequestFoundKobold
Bases: NoValidRequestFound
The number of jobs a worker was skipped for, and why.
v2 API Model: NoValidRequestFoundKobold
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/pop.py
max_context_length
class-attribute
instance-attribute
How many waiting requests were skipped because they demanded a higher max_context_length than what this worker provides.
max_length
class-attribute
instance-attribute
How many waiting requests were skipped because they demanded a higher max_length than what this worker provides.
matching_softprompt
class-attribute
instance-attribute
How many waiting requests were skipped because they demanded an available soft-prompt which this worker does not have.
model_config
class-attribute
instance-attribute
blacklist
class-attribute
instance-attribute
How many waiting requests were skipped because they demanded a generation with a word that this worker does not accept.
bridge_version
class-attribute
instance-attribute
How many waiting requests were skipped because they require a higher version of the bridge than this worker is running (upgrade if you see this in your skipped list).
kudos
class-attribute
instance-attribute
How many waiting requests were skipped because the user didn't have enough kudos when this worker requires
models
class-attribute
instance-attribute
How many waiting requests were skipped because they demanded a different model than what this worker provides.
nsfw
class-attribute
instance-attribute
How many waiting requests were skipped because they demanded a nsfw generation which this worker does not provide.
performance
class-attribute
instance-attribute
How many waiting requests were skipped because they demanded a higher performance than this worker provides.
untrusted
class-attribute
instance-attribute
How many waiting requests were skipped because they demanded a trusted worker which this worker is not.
worker_id
class-attribute
instance-attribute
How many waiting requests were skipped because they demanded a specific worker.
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
TextGenerateJobPopResponse
Bases: HordeResponseBaseModel, ResponseRequiringFollowUpMixin, ExtraSourceImageMixin
Request additional jobs, if any are available, for a text generation worker.
This is the key response type for all text generation workers as it contains all assignment data for the worker.
Represents the data returned from the /v2/generate/text/pop endpoint with http status code 200.
v2 API Model: GenerationPayloadKobold
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/pop.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
id_
class-attribute
instance-attribute
The UUID for this text generation.
skipped
class-attribute
instance-attribute
The skipped requests that were not valid for this worker.
softprompt
class-attribute
instance-attribute
The soft prompt requested for this generation.
model
class-attribute
instance-attribute
The model requested for this generation.
ttl
class-attribute
instance-attribute
The amount of seconds before this job is considered stale and aborted.
messages
class-attribute
instance-attribute
The messages sent to this worker.
model_config
class-attribute
instance-attribute
extra_source_images
class-attribute
instance-attribute
Additional uploaded images (as base64) which can be used for further operations.
time_constructed
property
The time the model was constructed (in epoch time).
validate_id
Validate the ID is not an empty string.
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/pop.py
ids_present
Ensure that either id_ or ids is present.
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/pop.py
get_api_model_name
classmethod
get_follow_up_default_request_type
classmethod
get_follow_up_failure_cleanup_request_type
classmethod
get_follow_up_returned_params
async_download_additional_data
async
download_additional_data
__eq__
__hash__
download_file_as_base64
async
Download a file and return the value as a base64 string.
Source code in horde_sdk/generic_api/apimodels.py
download_file_to_field_as_base64
async
download_file_to_field_as_base64(
client_session: ClientSession, url: str, field_name: str
) -> None
Download a file from a URL and save it to the field.
Parameters:
-
client_session(ClientSession) –The aiohttp client session to use for the download.
-
url(str) –The URL to download the file from.
-
field_name(str) –The name of the field to save the file to.
Source code in horde_sdk/generic_api/apimodels.py
async_download_extra_source_images
async
async_download_extra_source_images(
client_session: ClientSession, *, max_retries: int = 5
) -> list[ExtraSourceImageEntry] | None
Download the extra source images concurrently.
You can also use get_downloaded_extra_source_images to get the downloaded images later, if needed.
Parameters:
-
client_session(ClientSession) –The aiohttp client session to use for downloading.
-
max_retries(int, default:5) –The maximum number of times to retry downloading an image.
Returns:
-
list[ExtraSourceImageEntry] | None–The downloaded extra source images.
Source code in horde_sdk/ai_horde_api/apimodels/generate/pop.py
get_downloaded_extra_source_images
Get the downloaded extra source images.
Source code in horde_sdk/ai_horde_api/apimodels/generate/pop.py
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
get_follow_up_request_types
classmethod
Return a list of all the possible follow up request types for this response.
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
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
TextGenerateJobPopRequest
Bases: BaseAIHordeRequest, APIKeyAllowedInRequestMixin, _PopInputKobold
Request additional jobs, if any are available, for a text worker.
This is the key request type for all text workers as it contains all the parameters needed to request a job.
Represents a POST request to the /v2/generate/text/pop endpoint.
v2 API Model: PopInputKobold
Source code in horde_sdk/ai_horde_api/apimodels/generate/text/pop.py
model_config
class-attribute
instance-attribute
amount
class-attribute
instance-attribute
The number of jobs to pop at the same time.
bridge_agent
class-attribute
instance-attribute
bridge_agent: str | None = Field(
"unknown:0:unknown",
examples=[
"AI Horde Worker reGen:4.1.0:https://github.com/Haidra-Org/horde-worker-reGen"
],
max_length=1000,
)
The worker name, version and website.
nsfw
class-attribute
instance-attribute
Whether this worker can generate NSFW requests or not.
priority_usernames
class-attribute
instance-attribute
The usernames that should be prioritized by this worker.
require_upfront_kudos
class-attribute
instance-attribute
require_upfront_kudos: bool | None = Field(
default=False,
description="If True, this worker will only pick up requests where the owner has the required kudos to consume already available.",
examples=[False],
)
If True, this worker will only pick up requests where the owner has the required kudos to consume already available.
threads
class-attribute
instance-attribute
threads: int | None = Field(
default=1,
description="How many threads this worker is running. This is used to accurately the current power available in the horde.",
ge=1,
le=50,
)
How many threads this worker is running. This is used to accurately the current power available in the horde.
max_length
class-attribute
instance-attribute
The maximum amount of tokens this worker can generate.
max_context_length
class-attribute
instance-attribute
The max amount of context to submit to this AI for sampling.
softprompts
class-attribute
instance-attribute
The available softprompt files on this worker for the currently running model.
extra_slow_worker
class-attribute
instance-attribute
If this worker is extra slow and requires a longer timeout.
Note that this reduces the pool of jobs available to this worker.
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_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
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_success_status_response_pairs
classmethod
Return a dict of HTTP status codes and the expected HordeResponse.
Defaults to {HTTPStatusCode.OK: cls.get_expected_response_type()}, but may be overridden to support other
status codes.
Source code in horde_sdk/generic_api/apimodels.py
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.