2.0 KiB
2.0 KiB
Ruby Rails Documentation Generator
A DSPy program that generates documentation for Rails applications using Recursive Language Models (RLMs).
What are RLMs?
Recursive Language Models are an inference strategy where language models can decompose and recursively interact with input context of unbounded length through REPL environments. Instead of processing huge contexts in a single call, an RLM allows the model to programmatically partition, grep, and recursively sub-query the context—avoiding context rot while handling arbitrarily large inputs.
Key benefits:
- Near-infinite effective context length
- Reduced context rot degradation
- Cost-efficient processing of large codebases
For more details, see the RLM paper.
Installation
uv add modaic dspy
Usage
Load with AutoProgram
from modaic import AutoProgram
# Load the program from Modaic Hub
doc_writer = AutoProgram.from_precompiled("farouk1/ruby-rails-doc-generator")
# Generate documentation for a Rails project
result = doc_writer(source_root="./my-rails-app")
print(result.documentation)
Override Config
from modaic import AutoProgram
doc_writer = AutoProgram.from_precompiled(
"farouk1/ruby-rails-doc-generator",
config={"max_iterations": 15, "lm": "openai/gpt-5"}
)
Load a Specific Revision
from modaic import AutoProgram
# By branch
doc_writer = AutoProgram.from_precompiled("farouk1/ruby-rails-doc-generator", rev="dev")
# By tag
doc_writer = AutoProgram.from_precompiled("farouk1/ruby-rails-doc-generator", rev="v1.0")
# By commit hash
doc_writer = AutoProgram.from_precompiled("farouk1/ruby-rails-doc-generator", rev="918ad95")
Configuration
| Parameter | Default | Description |
|---|---|---|
max_iterations |
10 | Maximum RLM iterations |
lm |
openai/gpt-5-mini |
Primary language model |
sub_lm |
openai/gpt-5-mini |
Model for recursive sub-calls |
License
MIT