package ocaml-ai-sdk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=637f60398f673dfb2e661f6ed7da169b823a870d27b48e729d5b9200e46a52b2
sha512=5aec259473395025edb6689b544e57e821cfbef9352987f95eb2182034979ce898040e06e60a9d89a40a187b77fb5b1b7183c7ec4264da9d9a834864860a5fed
doc/ocaml-ai-sdk.ai_core/Ai_core/Prompt_builder/index.html
Module Ai_core.Prompt_builderSource
Build provider-layer prompt messages from user-friendly inputs.
val messages_of_prompt :
?system:string ->
prompt:string ->
unit ->
Ai_provider.Prompt.message listConvert a simple string prompt to provider messages. Prepends a system message if system is provided.
val messages_of_string_messages :
?system:string ->
messages:(string * string) list ->
unit ->
Ai_provider.Prompt.message listConvert (role, content) pairs to provider messages. Roles: "system", "user", "assistant". Prepends a system message if system is provided.
val append_assistant_and_tool_results :
messages:Ai_provider.Prompt.message list ->
assistant_content:Ai_provider.Content.t list ->
tool_results:Generate_text_result.tool_result list ->
Ai_provider.Prompt.message listAppend an assistant response and tool results to the message list for the next iteration of the tool loop.
val resolve_messages :
?system:string ->
?system_provider_options:Ai_provider.Provider_options.t ->
?prompt:string ->
?messages:Ai_provider.Prompt.message list ->
unit ->
Ai_provider.Prompt.message listBuild the initial message list from either prompt (string) or messages. Prepends system message if provided. Raises if both or neither are given. ?system_provider_options attaches provider-specific options to the prepended system message (use with Ai_provider_anthropic.Cache_control_options.with_cache_control to mark the system prompt as a cache breakpoint).
val make_call_options :
messages:Ai_provider.Prompt.message list ->
tools:Ai_provider.Tool.t list ->
?tool_choice:Ai_provider.Tool_choice.t ->
?mode:Ai_provider.Mode.t ->
?max_output_tokens:int ->
?temperature:float ->
?top_p:float ->
?top_k:int ->
?stop_sequences:string list ->
?seed:int ->
?provider_options:Ai_provider.Provider_options.t ->
?headers:(string * string) list ->
unit ->
Ai_provider.Call_options.tBuild a Call_options.t with common defaults.
Convert Core SDK tools to provider-layer tool definitions.