Module Ai_provider.PromptSource

Prompt messages with role-constrained content parts.

Each message role restricts which content parts are valid:

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. | 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.