Module Ai_providerSource

OCaml AI SDK — Provider abstraction layer.

Type-safe, provider-agnostic types and module signatures for AI model integration. Inspired by Vercel AI SDK's V3 specification.

Sourcemodule Provider_options : sig ... end

Provider-specific options using an extensible GADT. Each provider registers its own typed key without circular dependencies.

Sourcemodule Finish_reason : sig ... end

Reason why model generation finished.

Sourcemodule Usage : sig ... end

Token usage statistics.

Sourcemodule Warning : sig ... end

Warnings emitted by providers for unsupported features.

Sourcemodule Provider_error : sig ... end

Errors from provider API calls.

Sourcemodule Prompt : sig ... end

Prompt messages with role-constrained content parts.

Sourcemodule Tool : sig ... end

Tool definition for function calling.

Sourcemodule Tool_choice : sig ... end

Strategy for tool selection during generation.

Sourcemodule Mode : sig ... end

Generation mode -- controls the shape of model output.

Sourcemodule Content : sig ... end

Response content parts returned by model generation.

Sourcemodule Call_options : sig ... end

Unified input options for both generate and stream calls.

Sourcemodule Generate_result : sig ... end

Result of a non-streaming generation call.

Sourcemodule Stream_part : sig ... end

Individual parts emitted during streaming generation.

Sourcemodule Stream_result : sig ... end

Result of a streaming generation call.

Sourcemodule Language_model : sig ... end

Core abstraction for AI language models.

Sourcemodule Provider : sig ... end

Factory for creating model instances from a provider.

Sourcemodule Middleware : sig ... end

Middleware for cross-cutting concerns (logging, caching, retries).

Sourcemodule Sse : sig ... end

Server-Sent Events parser for streaming API responses.