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