package ocaml-ai-sdk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

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.