Module Chatoyant_provider.ProviderSource

Provider-neutral contracts.

Raw provider implementations should expose complete faithful API clients. Unified adapters can then implement these signatures to plug into Chatoyant_core without forcing the core to know provider-specific wire details.

Sourcetype id =
  1. | Openai
  2. | Anthropic
  3. | Xai
  4. | Local
  5. | Openrouter
Sourcetype role =
  1. | System
  2. | User
  3. | Assistant
  4. | Tool
Sourcetype tool_call = {
  1. id : string;
  2. name : string;
  3. arguments : Chatoyant_runtime.Json.t;
  4. arguments_json : string;
  5. raw : Chatoyant_runtime.Json.t option;
}

Normalized assistant tool call. arguments_json preserves partial or provider-original argument text when JSON parsing is impossible; arguments is Null in that case.

Sourcetype message = {
  1. role : role;
  2. content : string option;
  3. name : string option;
  4. tool_call_id : string option;
  5. tool_calls : tool_call list;
  6. tool_result_error : bool option;
}
Sourcetype tool_definition = {
  1. tool_name : string;
  2. tool_description : string option;
  3. tool_parameters : Chatoyant_runtime.Json.t;
  4. tool_strict : bool option;
}
Sourcetype options = {
  1. model : string;
  2. temperature : float option;
  3. max_tokens : int option;
  4. top_p : float option;
  5. stop : string list;
  6. frequency_penalty : float option;
  7. presence_penalty : float option;
  8. thinking_budget : int option;
  9. reasoning_effort : string option;
  10. timeout_ms : int option;
  11. tools : tool_definition list;
  12. tool_choice : string option;
  13. extra : Chatoyant_runtime.Json.t option;
}
Sourcetype error =
  1. | Missing_api_key of {
    1. provider : id;
    2. env_key : string;
    }
  2. | Http_error of {
    1. status : int;
    2. body : string;
    }
  3. | Decode_error of string
  4. | Unsupported of string
  5. | Runtime_error of string
Sourcetype generation = {
  1. content : string;
  2. reasoning_content : string;
  3. usage : Chatoyant_tokens.Cost.usage;
  4. usage_source : Chatoyant_tokens.Cost.source;
  5. tool_calls : tool_call list;
  6. finish_reason : string option;
  7. raw : Chatoyant_runtime.Json.t option;
}
Sourcemodule type CHAT = sig ... end
Sourceval string_of_id : id -> string
Sourceval id_of_string : string -> id option
Sourceval error_to_string : error -> string
Sourceval tool_definition_to_json : tool_definition -> Chatoyant_runtime.Json.t
Sourceval tool_call_to_json : tool_call -> Chatoyant_runtime.Json.t
Sourceval generation_to_json : generation -> Chatoyant_runtime.Json.t