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.1.tbz
sha256=cb3b82428abcda76c02ec92f8103a4db28edf3f42795794a37135e9a3c40af96
sha512=11be8889ee25bee67b2be00553c42a4692bc73e5ce23985e8bb87f8a07e9d8f556b5a63b219fe5fe30366c8b0d4edae494afa80ccfbfcb112f1fa1e458de55bf

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.