Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.PHONY: help install install-dev install-modal run-all \
quickstart docker-repl lm-repl modal-repl \
lint format test check

help:
@echo "RLM Examples Makefile"
@echo ""
@echo "Usage:"
@echo " make install - Install base dependencies with uv"
@echo " make install-dev - Install dev dependencies with uv"
@echo " make install-modal - Install modal dependencies with uv"
@echo " make run-all - Run all examples (requires all deps and API keys)"
@echo ""
@echo "Examples:"
@echo " make quickstart - Run quickstart.py (needs OPENAI_API_KEY)"
@echo " make docker-repl - Run docker_repl_example.py (needs Docker)"
@echo " make lm-repl - Run lm_in_repl.py (needs PORTKEY_API_KEY)"
@echo " make modal-repl - Run modal_repl_example.py (needs Modal)"
@echo ""
@echo "Development:"
@echo " make lint - Run ruff linter"
@echo " make format - Run ruff formatter"
@echo " make test - Run tests"
@echo " make check - Run lint + format + tests"

install:
uv sync

install-dev:
uv sync --group dev --group test

install-modal:
uv pip install -e ".[modal]"

run-all: quickstart docker-repl lm-repl modal-repl

quickstart: install
uv run python -m examples.quickstart

docker-repl: install
uv run python -m examples.docker_repl_example

lm-repl: install
uv run python -m examples.lm_in_repl

modal-repl: install-modal
uv run python -m examples.modal_repl_example

lint: install-dev
uv run ruff check .

format: install-dev
uv run ruff format .

test: install-dev
uv run pytest

check: lint format test
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,17 @@ uv init && uv venv --python 3.12 # change version as needed
uv pip install -e .
```

To run a quick test, the following will run an RLM query with the OpenAI client using your environment variable `OPENAI_API_KEY` (feel free to change this). This will generate console output as well as a log which you can use with the visualizer to explore the trajectories.
### Makefile Usage
This project includes a `Makefile` to simplify common tasks.

- `make install`: Install base dependencies.
- `make install-dev`: Install development dependencies.
- `make check`: Run linter, formatter, and tests.
- `make quickstart`: Run the quickstart example.

To run a quick test, the following will run an RLM query with the OpenAI client using your environment variable `OPENAI_API_KEY` (feel free to change this). This will generate console output as well as a log which you can use with the visualizer to explore the trajectories.
```bash
uv run examples/quickstart.py
make quickstart
```

The default RLM client uses a REPL environment that runs on the host process through Python `exec` calls. It uses the same virtual environment as the host process (i.e. it will have access to the same dependencies), but with some limitations in its available global modules. As an example, we can call RLM completions using GPT-5-nano:
Expand Down