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.3.tbz
sha256=0cc0a957784c295877b6bcc4f80c0dba0f6507d3c282e7d6cbd71038050376de
sha512=f8e082376b4de194a877d0df193892cdaa8139a4789f51eebac651acf8b6d4064b95242e158d86c1a32776d99130d43ed4c1119e2d54e738e93bdba2a6ad9a33

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.