Files
ruby-rails-doc-generator/README.md
2026-01-19 16:50:52 -08:00

74 lines
2.0 KiB
Markdown

# Ruby Rails Documentation Generator
A DSPy program that generates documentation for Rails applications using Recursive Language Models (RLMs). Created by [Drew Breunig](https://x.com/dbreunig?s=20)
## 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](https://arxiv.org/abs/2512.24601v1).
## Installation
```bash
uv add modaic dspy
```
## Usage
### Load with AutoProgram
```python
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
```python
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
```python
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