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.1.tbz
sha256=cb3b82428abcda76c02ec92f8103a4db28edf3f42795794a37135e9a3c40af96
sha512=11be8889ee25bee67b2be00553c42a4692bc73e5ce23985e8bb87f8a07e9d8f556b5a63b219fe5fe30366c8b0d4edae494afa80ccfbfcb112f1fa1e458de55bf
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)"
>