Ragex.Analysis.Suggestions.RAGAdvisor
(Ragex v0.3.0)
View Source
RAG-powered advice generation for refactoring suggestions.
Uses the RAG pipeline to generate context-aware, AI-powered advice for each refactoring suggestion, including:
- Detailed explanations of why the refactoring is beneficial
- Concrete implementation steps specific to the codebase
- Code examples from similar patterns in the codebase
- Potential pitfalls and risks to watch for
Usage
alias Ragex.Analysis.Suggestions.RAGAdvisor
{:ok, advice} = RAGAdvisor.generate_advice(suggestion)
IO.puts(advice)
Summary
Functions
Checks if RAG advice generation is available.
Generates AI-powered advice for a suggestion.
Generates advice for multiple suggestions in batch.
Functions
Checks if RAG advice generation is available.
Returns true if an AI provider is configured, false otherwise.
Generates AI-powered advice for a suggestion.
Parameters
suggestion- Scored suggestion with pattern, target, and metricsopts- Options::provider- AI provider to use (default: from config):temperature- AI temperature (default: 0.7):max_tokens- Max response tokens (default: 500)
Returns
{:ok, advice_text}- Generated advice string{:error, reason}- Error if generation fails
Generates advice for multiple suggestions in batch.
More efficient than calling generate_advice/2 multiple times.
Parameters
suggestions- List of suggestionsopts- Options (same as generate_advice/2)
Returns
{:ok, suggestions_with_advice}- Suggestions with added:rag_advicefield{:error, reason}- Error if batch generation fails