Expand description
§rust_llm_cli
RubyLLM’s Rails generators (lib/generators/ruby_llm/*) as a rust-llm CLI for Loco + Inertia
+ React apps.
Install it from a checkout of the repository, then run it from the root of a Loco app:
cargo install --path crates/rust_llm_cli
rust-llm generate install --path <rust-llm checkout>| RubyLLM | rust-llm |
|---|---|
bin/rails g ruby_llm:install | rust-llm generate install [--path RUST_LLM_CHECKOUT] |
bin/rails g ruby_llm:tool Weather | rust-llm generate tool Weather |
bin/rails g ruby_llm:agent Support | rust-llm generate agent Support |
bin/rails g ruby_llm:schema Product | rust-llm generate schema Product |
bin/rails g ruby_llm:chat_ui | rust-llm generate chat_ui |
| (none) | rust-llm generate public_chat: a no-sign-in, rate-limited streaming chat page |
script/generate-provider NAME (core mode) | rust-llm generate provider NAME [--dialect D] [--api-base URL] [--models-dev-provider KEY] [--dynamic-models] [--destination DIR] |
bin/rails g ruby_llm:upgrade | rust-llm generate upgrade |
g is short for generate, and every generator takes --force. Like Rails generators,
existing files are skipped unless --force, injections are skipped when already present, and
every path is printed with its action (create, identical, skip, force, insert). An
injection whose anchor is missing is reported and fails the run. See the
generators guide.
Modules§
- agent
- Port of
lib/generators/ruby_llm/agent/agent_generator.rb: an agent and its (empty) instructions prompt. - chat_ui
- Port of
lib/generators/ruby_llm/chat_ui/chat_ui_generator.rbfor the Loco + Inertia starter kit: Inertia + React + shadcn/ui instead of ERB + Turbo, inside the kit’s accounts. - install
- Port of
lib/generators/ruby_llm/install/install_generator.rb: dependencies, the migration, the initializer, the chat/message models, and the convention directories. - provider
- Port of
lib/generators/ruby_llm/provider/scaffold.rbincoremode (script/generate-provider): a provider module and its test inside therust_llmcrate. There is no gem split in Rust, so theprovider-gemmode is not ported. - public_
chat rust-llm generate public_chat: a chat page anyone can try without signing in, for demos. RubyLLM has no counterpart (its chat UI is for signed-in users of the app).- schema
- Port of
lib/generators/ruby_llm/schema/schema_generator.rb: an empty schema type. RubyLLM’s is aSchematist::Schemasubclass; here it is aschemars::JsonSchemastruct, whichChat::with_schema_forturns into the same JSON schema. - tool
- Port of
lib/generators/ruby_llm/tool/tool_generator.rb: a tool plus its call/result components (thetool_calls/_<name>andtool_results/_<name>partials). - upgrade
lib/generators/ruby_llm/upgrade/upgrade_generator.rb: moves an app’s schema from the previous release to this one. RubyLLM ships the upgrade for the changes since its previous release only, and replaces it each release.
Structs§
- Generator
- Runs one generator against an app directory, recording what it did.
Enums§
- Anchor
- Where an injected line goes, like Thor’s
inject_into_file before:/after:.
Constants§
Functions§
- camelize
- ActiveSupport’s
camelizefor a generator NAME:weather_lookup/weather-lookup->WeatherLookup; an already camel-cased name is kept. - class_
name - Rails’ NamedBase NAME check. Namespaced names (
admin/weather,Admin::Weather) are not supported: Rust modules would need amod.rsper level. - render
- Replaces each
{{key}}in an embedded template. Keys never contain spaces, so JSX{{ ... }}and Rust{{}}pass through untouched. - run
- Parses
generate <generator> [NAME] [options]and runs it incwd. Returns the exit code. - underscore
- ActiveSupport’s
underscore, acronym-aware likeTool.tool_name(HTTPProxy->http_proxy).