package chatoyant
Build not checkedInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=7d2851d5866e9559e38f5be15faced64b9b371dfb4f19e4d2de9d6f4590a7d58
sha512=afb615027fa7c3780a264e956d1b17b924b726f4c1dd6d5c7558ccc9ec0bd76a07f4f6e76db1037f0a57582811090b74bcac4033af408b2eb6b91abb75546173
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 ->
?anthropic_version:string ->
?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.
Append a user message, optionally with image/file attachments.
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