package ocaml-ai-sdk
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
OCaml AI SDK - Provider abstraction for AI models
Install
dune-project
Dependency
Authors
Maintainers
Sources
ocaml-ai-sdk-0.6.2.tbz
sha256=637f60398f673dfb2e661f6ed7da169b823a870d27b48e729d5b9200e46a52b2
sha512=5aec259473395025edb6689b544e57e821cfbef9352987f95eb2182034979ce898040e06e60a9d89a40a187b77fb5b1b7183c7ec4264da9d9a834864860a5fed
doc/src/ocaml-ai-sdk.ai_provider/retry_after.ml.html
Source file retry_after.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31(* Strict numeric parse for machine headers: trims surrounding whitespace, rejects NaN/infinity (which [float_of_string_opt] would otherwise accept), and rejects negative values. Returns the parsed non-negative finite float. *) let parse_non_negative_seconds value = match float_of_string_opt (String.trim value) with | Some f when Float.is_finite f && f >= 0.0 -> Some f | Some _ | None -> None (* retry-after-ms is milliseconds. A present, numeric value wins outright: upstream sets [ms] from it and never falls through to retry-after, so a negative or infinite millisecond value resolves to [None] overall rather than deferring to retry-after. A missing, non-numeric, or NaN value falls through (upstream's [parseFloat] yields NaN for non-numeric input, which its [!isNaN] guard treats the same as absent). *) let of_retry_after_ms value = match float_of_string_opt (String.trim value) with | Some ms when Float.is_nan ms -> `Fall_through | Some ms when Float.is_finite ms && ms >= 0.0 -> `Seconds (ms /. 1000.0) | Some _ -> `Rejected | None -> `Fall_through let parse ~retry_after_ms ~retry_after = let from_ms = match retry_after_ms with | Some value -> of_retry_after_ms value | None -> `Fall_through in match from_ms with | `Seconds s -> Some s | `Rejected -> None | `Fall_through -> Option.bind retry_after parse_non_negative_seconds
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>