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.5.tbz
sha256=9e3437d6ebf48ec9f5d9a8afd62eaeece124023f02dbd87e4b291205fd309b72
sha512=605c10ed62c0cbc31a151b7031cc80a284d5c94231c1ef423ae7439572e3fadddab4a45f52eaeeef83973a8e324839b9fda03f9082deef1b6781353f63975510

doc/ocaml-ai-sdk.ai_provider_openrouter/Ai_provider_openrouter/Convert_response/index.html

Module Ai_provider_openrouter.Convert_responseSource

OpenRouter response conversion.

Sourcetype reasoning_detail_json = {
  1. type_ : string;
  2. text : string option;
  3. signature : string option;
  4. data : string option;
  5. summary : string option;
}

JSON representation of a reasoning detail (text, encrypted, or summary).

Sourceval reasoning_detail_json_of_json : Yojson.Basic.t -> reasoning_detail_json

Provider metadata keys.

Sourceval convert_reasoning_detail : reasoning_detail_json -> Ai_provider.Content.t option

Convert a single reasoning detail to an SDK content part.

Sourcetype annotation_json = {
  1. type_ : string;
  2. url : string option;
  3. title : string option;
  4. start_index : int option;
  5. end_index : int option;
}

JSON representation of an annotation (e.g. url_citation from web search).

Sourceval annotation_json_of_json : Yojson.Basic.t -> annotation_json
Sourceval convert_annotation : index:int -> annotation_json -> Ai_provider.Content.t option

Convert a url_citation annotation to a Source content part. ~index is used to generate a unique ID for the source.

Sourcetype image_json = {
  1. url : string;
}

JSON representation of an image in the response.

Sourceval image_json_of_json : Yojson.Basic.t -> image_json
Sourceval convert_image : image_json -> Ai_provider.Content.t option

Convert an image response to a File content part.

Sourceval has_encrypted_reasoning : reasoning_detail_json list -> bool

Check whether any reasoning details contain encrypted reasoning.

Sourceval map_finish_reason : string option -> Ai_provider.Finish_reason.t

Map OpenRouter finish reason string to SDK finish reason.

Parse a JSON response into a generate result.