package ocaml-ai-sdk

  1. Overview
  2. Docs
OCaml AI SDK - Provider abstraction for AI models

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ocaml-ai-sdk-0.6.tbz
sha256=44e7f6ebef6da2828ec2844dd5b38c8f37284c08e54a29e06f6a8822df6f8e10
sha512=ce31d0868abf28bcaef7b24a0ab09b37dcfc94db3de96b38ff36a03800ae59a19e8009a35314f93191b3c8f178c40f8569630d4389f56ddc2f2cc94fb7bffc3c

doc/ocaml-ai-sdk.ai_provider/Ai_provider/Prompt/index.html

Module Ai_provider.PromptSource

Prompt messages with role-constrained content parts.

Each message role restricts which content parts are valid:

  • System: text only
  • User: text and files
  • Assistant: text, files, reasoning, and tool calls
  • Tool: tool results only
Sourcetype file_data =
  1. | Bytes of bytes
  2. | Base64 of string
  3. | Url of string

How file data is represented.

Sourcetype user_part =
  1. | Text of {
    1. text : string;
    2. provider_options : Provider_options.t;
    }
  2. | File of {
    1. data : file_data;
    2. media_type : string;
    3. filename : string option;
    4. provider_options : Provider_options.t;
    }

A single part in a user message.

Sourcetype assistant_part =
  1. | Text of {
    1. text : string;
    2. provider_options : Provider_options.t;
    }
  2. | File of {
    1. data : file_data;
    2. media_type : string;
    3. filename : string option;
    4. provider_options : Provider_options.t;
    }
  3. | Reasoning of {
    1. text : string;
    2. provider_options : Provider_options.t;
    }
  4. | Tool_call of {
    1. id : string;
    2. name : string;
    3. args : Yojson.Basic.t;
    4. provider_options : Provider_options.t;
    }

A single part in an assistant message.

Sourcetype tool_result_content =
  1. | Result_text of string
  2. | Result_image of {
    1. data : string;
    2. media_type : string;
    }

Content returned with a tool result.

Sourcetype tool_result = {
  1. tool_call_id : string;
  2. tool_name : string;
  3. result : Yojson.Basic.t;
  4. is_error : bool;
  5. content : tool_result_content list;
  6. provider_options : Provider_options.t;
}

A tool execution result.

Sourcetype message =
  1. | System of {
    1. content : string;
    2. provider_options : Provider_options.t;
    }
  2. | User of {
    1. content : user_part list;
    }
  3. | Assistant of {
    1. content : assistant_part list;
    }
  4. | Tool of {
    1. content : tool_result list;
    }

A prompt message. The role constrains valid content parts.