llm_wire/limit
Names every byte and count bound that LLM Wire applies to a call.
Set a bound with llm_wire.with_limit; a call that exceeds it fails with
error.LimitExceeded naming the same Limit, so the error says which
setter raises it:
import llm_wire
import llm_wire/limit
let config =
openai.new(key) |> openai.config
|> llm_wire.with_limit(limit.TotalTextBytes, 8_388_608)
| Limit | Default | Bounds |
|---|---|---|
RequestBytes | 1 MiB | the encoded request body |
ChunkBytes | 64 KiB | one transport chunk |
LineBytes | 1 MiB | one SSE line |
EventBytes | 1 MiB | one SSE event |
ResponseBodyBytes | 8 MiB | the whole streamed response |
ErrorBodyBytes | 64 KiB | the body of a non-200 response |
QueueCount | 500 | progress items waiting for next |
QueueBytes | 2 MiB | bytes of progress waiting for next |
ActiveBlocks | 64 | text, reasoning and tool blocks open at once |
TextBytesPerBlock | 1 MiB | one text, refusal or reasoning block |
TotalTextBytes | 4 MiB | all text of one response |
ArgumentBytesPerCall | 1 MiB | one tool call’s arguments |
TotalArgumentBytes | 4 MiB | all tool-call arguments of one response |
ProviderMetadataBytes | 1 MiB | ids, signatures and replay data |
ExtensionBytes | 16 KiB | the name of an unrecognized provider event |
Every limit must be positive; llm_wire.prepare rejects any other value
with error.InvalidSetting(error.LimitSetting(limit), ..).
Types
One bound of a call. Never gains a variant without a new setter value.
pub type Limit {
RequestBytes
ChunkBytes
LineBytes
EventBytes
ResponseBodyBytes
ErrorBodyBytes
QueueCount
QueueBytes
ActiveBlocks
TextBytesPerBlock
TotalTextBytes
ArgumentBytesPerCall
TotalArgumentBytes
ProviderMetadataBytes
ExtensionBytes
}
Constructors
-
RequestBytes -
ChunkBytes -
LineBytes -
EventBytes -
ResponseBodyBytes -
ErrorBodyBytes -
QueueCount -
QueueBytes -
ActiveBlocks -
TextBytesPerBlock -
TotalTextBytes -
ArgumentBytesPerCall -
TotalArgumentBytes -
ProviderMetadataBytes -
ExtensionBytes