Module: OpenRouter::Routing
- Included in:
- Client
- Defined in:
- lib/open_router/routing.rb
Overview
Mixin providing ergonomic access to OpenRouter router/meta-model features (Fusion, Pareto Code Router). Builds the right model alias + plugin config and delegates to Client#complete.
Constant Summary collapse
- FUSION_MODEL =
"openrouter/fusion"- PARETO_CODE_MODEL =
"openrouter/pareto-code"
Instance Method Summary collapse
-
#fuse(messages, analysis_models: nil, judge: nil, preset: nil, max_tool_calls: nil, **opts) ⇒ Object
Fan a prompt out to a panel of models and synthesize one answer.
-
#pareto_complete(messages, min_coding_score: nil, **opts) ⇒ Object
Route to the cheapest code-capable model meeting a quality bar.
Instance Method Details
#fuse(messages, analysis_models: nil, judge: nil, preset: nil, max_tool_calls: nil, **opts) ⇒ Object
Fan a prompt out to a panel of models and synthesize one answer. NOTE: Fusion costs ~4–5x a single completion (panel calls + judge).
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/open_router/routing.rb', line 31 def fuse(, analysis_models: nil, judge: nil, preset: nil, max_tool_calls: nil, **opts) validate_analysis_models!(analysis_models) validate_max_tool_calls!(max_tool_calls) plugin = { id: "fusion", analysis_models: analysis_models, model: judge, # OpenRouter Fusion plugin field is 'model', not 'judge' preset: preset&.to_s, max_tool_calls: max_tool_calls }.compact kwargs = merge_plugin(opts, plugin) complete(, model: FUSION_MODEL, **kwargs) end |
#pareto_complete(messages, min_coding_score: nil, **opts) ⇒ Object
Route to the cheapest code-capable model meeting a quality bar.
14 15 16 17 18 19 20 21 22 |
# File 'lib/open_router/routing.rb', line 14 def pareto_complete(, min_coding_score: nil, **opts) validate_min_coding_score!(min_coding_score) plugin = { id: "pareto-router" } plugin[:min_coding_score] = min_coding_score unless min_coding_score.nil? kwargs = merge_plugin(opts, plugin) complete(, model: PARETO_CODE_MODEL, **kwargs) end |