ElixirScope.AI.LLM.Client (elixir_scope v0.0.1)

Main LLM client interface for ElixirScope.

Provides a simple, unified API for code analysis, error explanation, and fix suggestions. Handles provider selection and automatic fallback from Vertex/Gemini to Mock provider on errors.

Summary

Functions

Analyzes code using the configured LLM provider.

Explains an error using the configured LLM provider.

Gets the current provider configuration.

Suggests a fix using the configured LLM provider.

Tests connectivity to the primary provider.

Functions

analyze_code(code, context \\ %{})

@spec analyze_code(String.t(), map()) :: ElixirScope.AI.LLM.Response.t()

Analyzes code using the configured LLM provider.

Examples

iex> ElixirScope.AI.LLM.Client.analyze_code("def hello, do: :world")
%ElixirScope.AI.LLM.Response{
  text: "This is a simple function definition...",
  success: true,
  provider: :vertex
}

explain_error(error_message, context \\ %{})

@spec explain_error(String.t(), map()) :: ElixirScope.AI.LLM.Response.t()

Explains an error using the configured LLM provider.

Examples

iex> ElixirScope.AI.LLM.Client.explain_error("undefined function foo/0")
%ElixirScope.AI.LLM.Response{
  text: "This error occurs when...",
  success: true,
  provider: :vertex
}

get_provider_status()

@spec get_provider_status() :: map()

Gets the current provider configuration.

suggest_fix(problem_description, context \\ %{})

@spec suggest_fix(String.t(), map()) :: ElixirScope.AI.LLM.Response.t()

Suggests a fix using the configured LLM provider.

Examples

iex> ElixirScope.AI.LLM.Client.suggest_fix("function is too complex")
%ElixirScope.AI.LLM.Response{
  text: "To reduce complexity, consider...",
  success: true,
  provider: :vertex
}

test_connection()

@spec test_connection() :: ElixirScope.AI.LLM.Response.t()

Tests connectivity to the primary provider.