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_openai/Ai_provider_openai/Convert_prompt/index.html

Module Ai_provider_openai.Convert_promptSource

Convert SDK prompt messages to OpenAI Chat Completions format.

Sourcetype openai_content_part =
  1. | O_text of {
    1. text : string;
    }
  2. | O_image_url of {
    1. url : string;
    }
Sourcetype openai_function_call = {
  1. name : string;
  2. arguments : string;
}
Sourcetype openai_tool_call = {
  1. id : string;
  2. type_ : string;
  3. function_ : openai_function_call;
}
Sourcetype openai_message =
  1. | System_msg of {
    1. content : string;
    }
  2. | Developer_msg of {
    1. content : string;
    }
  3. | User_msg of {
    1. content : openai_content_part list;
    }
  4. | Assistant_msg of {
    1. content : string option;
    2. tool_calls : openai_tool_call list;
    }
  5. | Tool_msg of {
    1. tool_call_id : string;
    2. content : string;
    }
Sourceval convert_messages : system_message_mode:Model_catalog.system_message_mode -> Ai_provider.Prompt.message list -> openai_message list * Ai_provider.Warning.t list

Convert SDK messages to OpenAI format. Returns converted messages and any warnings generated.

Sourceval openai_message_to_json : openai_message -> Yojson.Basic.t

Serialize an OpenAI message to JSON.