package chatoyant
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=1f84c5229b2d58ec6264dd651a58f2686130afa6e91989f110aa7aaf10bba0f5
sha512=49142e122dbb44b03f7f27b52839492800332207d0efeacc7451173827c899a9b965b671a3d9028cc05250aaebbc6789d3815a6cf356f4319bc0c1b0454c68dd
doc/chatoyant.native/Chatoyant_native/Chat/index.html
Module Chatoyant_native.ChatSource
Eio-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 meta :
?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 ->
tMeta Model API (Muse Spark) chat. When api_key is omitted, META_API_KEY is read from the process environment, then MODEL_API_KEY (the name Meta's own tooling uses).
val 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