Skip to main content

Crate rust_llm_cli

Crate rust_llm_cli 

Source
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>
RubyLLMrust-llm
bin/rails g ruby_llm:installrust-llm generate install [--path RUST_LLM_CHECKOUT]
bin/rails g ruby_llm:tool Weatherrust-llm generate tool Weather
bin/rails g ruby_llm:agent Supportrust-llm generate agent Support
bin/rails g ruby_llm:schema Productrust-llm generate schema Product
bin/rails g ruby_llm:chat_uirust-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:upgraderust-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.rb for 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.rb in core mode (script/generate-provider): a provider module and its test inside the rust_llm crate. There is no gem split in Rust, so the provider-gem mode 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 a Schematist::Schema subclass; here it is a schemars::JsonSchema struct, which Chat::with_schema_for turns into the same JSON schema.
tool
Port of lib/generators/ruby_llm/tool/tool_generator.rb: a tool plus its call/result components (the tool_calls/_<name> and tool_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§

USAGE

Functions§

camelize
ActiveSupport’s camelize for 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 a mod.rs per 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 in cwd. Returns the exit code.
underscore
ActiveSupport’s underscore, acronym-aware like Tool.tool_name (HTTPProxy -> http_proxy).