Chatoyant_native.ChatSourceEio-native stateful chat wrapper.
This hides provider/clock functor instantiation while preserving the same OCaml-owned session/tool-loop implementation underneath. Methods mutate the wrapped session and return t, so pipeline style remains natural.
val with_provider :
?model:string ->
?defaults:Chatoyant_core.Options.t ->
clock:_ Eio.Time.clock ->
(module Chatoyant_provider.Provider.CHAT) ->
tBuild a chat from any first-class Chatoyant provider.
val openai :
?https:Http.https ->
?max_response_size:int ->
?base_url:string ->
?timeout_ms:int ->
?model:string ->
?defaults:Chatoyant_core.Options.t ->
< net : _ Eio.Net.t ; clock : _ Eio.Time.clock.. > ->
?api_key:string ->
unit ->
tOpenAI chat. When api_key is omitted, OPENAI_API_KEY is read from the process environment and missing keys are reported as Chatoyant provider errors on generation.
val anthropic :
?https:Http.https ->
?max_response_size:int ->
?base_url:string ->
?timeout_ms:int ->
?beta_headers:string list ->
?model:string ->
?defaults:Chatoyant_core.Options.t ->
< net : _ Eio.Net.t ; clock : _ Eio.Time.clock.. > ->
?api_key:string ->
unit ->
tval xai :
?https:Http.https ->
?max_response_size:int ->
?base_url:string ->
?timeout_ms:int ->
?model:string ->
?defaults:Chatoyant_core.Options.t ->
< net : _ Eio.Net.t ; clock : _ Eio.Time.clock.. > ->
?api_key:string ->
unit ->
tval openrouter :
?https:Http.https ->
?max_response_size:int ->
?timeout_ms:int ->
?http_referer:string ->
?title:string ->
?headers:(string * string) list ->
?model:string ->
?defaults:Chatoyant_core.Options.t ->
< net : _ Eio.Net.t ; clock : _ Eio.Time.clock.. > ->
?api_key:string ->
unit ->
tval local :
?https:Http.https ->
?max_response_size:int ->
?api_key:string ->
?timeout_ms:int ->
?headers:(string * string) list ->
?model:string ->
?defaults:Chatoyant_core.Options.t ->
< net : _ Eio.Net.t ; clock : _ Eio.Time.clock.. > ->
base_url:string ->
unit ->
tProvider backing this chat. Useful for diagnostics and shortcut behavior.
val generate_with_result :
?options:Chatoyant_core.Options.t ->
?timeout_ms:int ->
?temperature:float ->
?max_tokens:int ->
?extra:Chatoyant_runtime.Json.t ->
t ->
(Chatoyant_core.Result.generation, Chatoyant_provider.Provider.error) resultval generate :
?options:Chatoyant_core.Options.t ->
?timeout_ms:int ->
?temperature:float ->
?max_tokens:int ->
?extra:Chatoyant_runtime.Json.t ->
t ->
(string, Chatoyant_provider.Provider.error) resultval ask :
?system:string ->
?tools:Chatoyant_core.Tool.t list ->
?options:Chatoyant_core.Options.t ->
?timeout_ms:int ->
?temperature:float ->
?max_tokens:int ->
?extra:Chatoyant_runtime.Json.t ->
string ->
t ->
(Chatoyant_core.Result.generation, Chatoyant_provider.Provider.error) resultAppend an optional system prompt, optional tools, the user prompt, then generate a full result. This is the compact app-facing path for one-turn interactions while preserving the stateful Chat API underneath.
val ask_text :
?system:string ->
?tools:Chatoyant_core.Tool.t list ->
?options:Chatoyant_core.Options.t ->
?timeout_ms:int ->
?temperature:float ->
?max_tokens:int ->
?extra:Chatoyant_runtime.Json.t ->
string ->
t ->
(string, Chatoyant_provider.Provider.error) resultLike ask, but returns only assistant text.
val stream_accumulate :
?options:Chatoyant_core.Options.t ->
Chatoyant_core.Stream.frame list ->
t ->
Chatoyant_core.Result.generation