package ocaml-ai-sdk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=0cc0a957784c295877b6bcc4f80c0dba0f6507d3c282e7d6cbd71038050376de
sha512=f8e082376b4de194a877d0df193892cdaa8139a4789f51eebac651acf8b6d4064b95242e158d86c1a32776d99130d43ed4c1119e2d54e738e93bdba2a6ad9a33
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.