package ocaml-ai-sdk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=cb3b82428abcda76c02ec92f8103a4db28edf3f42795794a37135e9a3c40af96
sha512=11be8889ee25bee67b2be00553c42a4692bc73e5ce23985e8bb87f8a07e9d8f556b5a63b219fe5fe30366c8b0d4edae494afa80ccfbfcb112f1fa1e458de55bf
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.