ElixirScope.AI.LLM.Provider behaviour (elixir_scope v0.0.1)
Behaviour defining the common interface for all LLM providers in ElixirScope.
This ensures all providers (Gemini, Mock, future providers) implement the same API, allowing for easy switching and fallback between providers.
Summary
Callbacks
Analyzes code using the provider's LLM.
Checks if the provider is properly configured and ready to use.
Explains an error using the provider's LLM.
Returns the provider's name as an atom.
Suggests a fix for a problem using the provider's LLM.
Tests the provider's connectivity and basic functionality.
Callbacks
@callback analyze_code(String.t(), map()) :: ElixirScope.AI.LLM.Response.t()
Analyzes code using the provider's LLM.
Parameters
code
: The Elixir code to analyzecontext
: Additional context for the analysis (metadata, file info, etc.)
Returns
Response.t()
: Standardized response with analysis results
@callback configured?() :: boolean()
Checks if the provider is properly configured and ready to use.
Returns
boolean()
: true if provider is configured, false otherwise
@callback explain_error(String.t(), map()) :: ElixirScope.AI.LLM.Response.t()
Explains an error using the provider's LLM.
Parameters
error_message
: The error message to explaincontext
: Additional context (code, stack trace, etc.)
Returns
Response.t()
: Standardized response with error explanation
@callback provider_name() :: atom()
Returns the provider's name as an atom.
Returns
atom()
: Provider identifier (e.g., :gemini, :mock, :anthropic)
@callback suggest_fix(String.t(), map()) :: ElixirScope.AI.LLM.Response.t()
Suggests a fix for a problem using the provider's LLM.
Parameters
problem_description
: Description of the problem to fixcontext
: Additional context (code, error details, etc.)
Returns
Response.t()
: Standardized response with fix suggestions
@callback test_connection() :: ElixirScope.AI.LLM.Response.t()
Tests the provider's connectivity and basic functionality.
Returns
Response.t()
: Response indicating success or failure of connection test