package ocaml-ai-sdk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=0cc0a957784c295877b6bcc4f80c0dba0f6507d3c282e7d6cbd71038050376de
sha512=f8e082376b4de194a877d0df193892cdaa8139a4789f51eebac651acf8b6d4064b95242e158d86c1a32776d99130d43ed4c1119e2d54e738e93bdba2a6ad9a33
doc/ocaml-ai-sdk.ai_provider_anthropic/Ai_provider_anthropic/Thinking/index.html
Module Ai_provider_anthropic.ThinkingSource
Thinking configuration for Claude models.
Thinking budget — always >= 1024 tokens. Use budget or budget_exn to construct.
Returns Error if budget < 1024.
Raises Invalid_argument if budget < 1024.
Extract the integer value.
type t = | Enabled of {budget_tokens : budget_tokens;display : display option;
}(*Manual thinking with an explicit token budget. Among the models the catalog knows, only pre-adaptive ones accept it, and Claude Haiku 4.5 is the last of those; the adaptive generation (Fable 5, Mythos 5, Opus 5, Opus 4.8, Sonnet 5) rejects it, so use
*)Adaptivewith an effort level there. A custom model id has unknown capabilities, so the SDK passes manual budgets through untouched and the API decides. Manual thinking also cannot be combined with a forced tool choice.| Adaptive of {display : display option;
}(*Adaptive thinking: the model decides how much to think, and
*)Anthropic_options.effortsets how hard. This pair is the successor toEnabled's token budgets. There is no faithful conversion from a budget to an effort level, so the caller picks the level rather than the SDK guessing one. Pre-adaptive models rejectAdaptive.| Disabled(*Turn thinking off. Not universally accepted: some models always think and reject it outright. On Claude Opus 5 it is accepted at any effort, but pairing it with
*)XhighorMaxlowers the effort toHighand emits a warning rather than raising.
How a model should think.
Which constructors a model accepts depends on its catalog capabilities, and passing an unsupported one raises Invalid_argument before the request is sent, mirroring the 400 the API would return.
Leaving thinking unset is not the same as Disabled. Whether omission leaves thinking on depends on the model: Fable 5, Mythos 5, Opus 5, and Sonnet 5 think by default, while Opus 4.8 and Haiku 4.5 do not. Only Disabled asks for thinking to be turned off explicitly.