Pipeline.Providers.AIProvider behaviour (pipeline v0.0.1)

View Source

Behavior for AI service providers (Claude, Gemini, etc.)

This interface allows swapping between live and mock implementations for testing and development.

Summary

Callbacks

Query the AI service with a prompt and options.

Functions

Get the provider implementation based on configuration.

Types

error_reason()

@type error_reason() :: String.t()

options()

@type options() :: map()

prompt()

@type prompt() :: String.t()

response()

@type response() :: %{text: String.t(), success: boolean(), cost: float()}

Callbacks

query(prompt, options)

@callback query(prompt(), options()) :: {:ok, response()} | {:error, error_reason()}

Query the AI service with a prompt and options.

Returns either a successful response with text, success status and cost, or an error with a reason string.

Functions

get_provider()

Get the provider implementation based on configuration.