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.tbz
sha256=44e7f6ebef6da2828ec2844dd5b38c8f37284c08e54a29e06f6a8822df6f8e10
sha512=ce31d0868abf28bcaef7b24a0ab09b37dcfc94db3de96b38ff36a03800ae59a19e8009a35314f93191b3c8f178c40f8569630d4389f56ddc2f2cc94fb7bffc3c
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)"
>