Class: Riffer::Config
- Inherits:
-
Object
- Object
- Riffer::Config
- Defined in:
- lib/riffer/config.rb
Overview
Configuration for the Riffer framework.
Provides configuration options for AI providers and other settings.
Riffer.config.openai.api_key = "sk-..."
Riffer.config.amazon_bedrock.region = "us-east-1"
Riffer.config.amazon_bedrock.api_token = "..."
Riffer.config.anthropic.api_key = "sk-ant-..."
Riffer.config.openrouter.api_key = "sk-or-..."
Riffer.config.evals.judge_model = "anthropic/claude-sonnet-4-20250514"
Defined Under Namespace
Classes: AmazonBedrock, Anthropic, AzureOpenAI, Evals, Gemini, Mcp, OpenAI, OpenRouter, Skills
Constant Summary collapse
- VALID_MESSAGE_ID_STRATEGIES =
%i[none uuid uuidv7].freeze
Instance Attribute Summary collapse
-
#amazon_bedrock ⇒ Object
readonly
Amazon Bedrock configuration (Struct with
api_tokenandregion). -
#anthropic ⇒ Object
readonly
Anthropic configuration (Struct with
api_key). -
#azure_openai ⇒ Object
readonly
Azure OpenAI configuration (Struct with
api_keyandendpoint). -
#evals ⇒ Object
readonly
Evals configuration (Struct with
judge_model). -
#experimental_history_healing ⇒ Object
Experimental: when
true, riffer keeps thetool_use↔tool_resultinvariant intact on its own. -
#gemini ⇒ Object
readonly
Google Gemini configuration (Struct with
api_key,open_timeout, andread_timeout). -
#mcp ⇒ Object
readonly
MCP configuration (Struct with
credentialsanddiscovery_runner). -
#message_id_strategy ⇒ Object
Strategy for auto-generating message ids.
-
#openai ⇒ Object
readonly
OpenAI configuration (Struct with
api_key). -
#openrouter ⇒ Object
readonly
OpenRouter configuration (Struct with
api_key). -
#skills ⇒ Object
readonly
Skills-related global configuration.
-
#tool_runtime ⇒ Object
Global tool runtime configuration (experimental).
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
– : () -> void.
Constructor Details
#initialize ⇒ Config
– : () -> void
203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/riffer/config.rb', line 203 def initialize @amazon_bedrock = AmazonBedrock.new @anthropic = Anthropic.new @azure_openai = AzureOpenAI.new @gemini = Gemini.new @openai = OpenAI.new @openrouter = OpenRouter.new @evals = Evals.new @mcp = Mcp.new(credentials: nil, discovery_runner: Riffer::Runner::Sequential.new) @tool_runtime = Riffer::Tools::Runtime::Inline.new @skills = Skills.new @message_id_strategy = :none @experimental_history_healing = false end |
Instance Attribute Details
#amazon_bedrock ⇒ Object (readonly)
Amazon Bedrock configuration (Struct with api_token and region).
83 84 85 |
# File 'lib/riffer/config.rb', line 83 def amazon_bedrock @amazon_bedrock end |
#anthropic ⇒ Object (readonly)
Anthropic configuration (Struct with api_key).
86 87 88 |
# File 'lib/riffer/config.rb', line 86 def anthropic @anthropic end |
#azure_openai ⇒ Object (readonly)
Azure OpenAI configuration (Struct with api_key and endpoint).
89 90 91 |
# File 'lib/riffer/config.rb', line 89 def azure_openai @azure_openai end |
#evals ⇒ Object (readonly)
Evals configuration (Struct with judge_model).
101 102 103 |
# File 'lib/riffer/config.rb', line 101 def evals @evals end |
#experimental_history_healing ⇒ Object
Experimental: when true, riffer keeps the tool_use ↔ tool_result invariant intact on its own.
-
On Riffer::Agent#generate(messages_array), orphaned
tool_useexchanges and parentlessRiffer::Messages::Toolmessages are silently stripped from the seed. Pending tool calls on the resume boundary (last assistant whose tail is purely Tool results) are preserved forexecute_pending_tool_calls. -
On any interrupt (caller-issued
interrupt!orINTERRUPT_MAX_STEPS), riffer fills any orphanedtool_usewith a placeholderRiffer::Messages::Toolcarrying error_type: :interrupted, leaving history valid for the next turn. Filled call_ids are exposed on Riffer::Agent::Response#healed_tool_call_ids (and the streamingRiffer::StreamEvents::Interruptevent).
Defaults to false — the pre-healing behavior. Experimental: the surface and default may change without notice.
178 179 180 |
# File 'lib/riffer/config.rb', line 178 def experimental_history_healing @experimental_history_healing end |
#gemini ⇒ Object (readonly)
Google Gemini configuration (Struct with api_key, open_timeout, and read_timeout).
92 93 94 |
# File 'lib/riffer/config.rb', line 92 def gemini @gemini end |
#mcp ⇒ Object (readonly)
MCP configuration (Struct with credentials and discovery_runner).
credentials is an optional Proc for per-run MCP tools/call HTTP headers. Signature: ->(manifest:, matched_tags:, context:) { Hash or nil }. nil from the proc at tool-resolution time omits that server’s tools; nil at tool-call time raises Riffer::Mcp::CredentialsDeniedError.
discovery_runner is the Riffer::Runner used to execute tool discovery (default Runner::Sequential).
112 113 114 |
# File 'lib/riffer/config.rb', line 112 def mcp @mcp end |
#message_id_strategy ⇒ Object
Strategy for auto-generating message ids. One of :none (default, no id), :uuid (UUIDv4), or :uuidv7 (time-ordered UUIDv7).
When set to anything other than :none, each Riffer::Messages::Base instance gets an id populated at construction time, and seeded messages passed to Riffer::Agent#generate must carry their own :id.
143 144 145 |
# File 'lib/riffer/config.rb', line 143 def @message_id_strategy end |
#openai ⇒ Object (readonly)
OpenAI configuration (Struct with api_key).
95 96 97 |
# File 'lib/riffer/config.rb', line 95 def openai @openai end |
#openrouter ⇒ Object (readonly)
OpenRouter configuration (Struct with api_key).
98 99 100 |
# File 'lib/riffer/config.rb', line 98 def openrouter @openrouter end |
#skills ⇒ Object (readonly)
Skills-related global configuration. Returns a Riffer::Config::Skills object — see Riffer.config.skills.default_activate_tool.
135 136 137 |
# File 'lib/riffer/config.rb', line 135 def skills @skills end |
#tool_runtime ⇒ Object
Global tool runtime configuration (experimental).
Accepts a Riffer::Tools::Runtime subclass, a Riffer::Tools::Runtime instance, or a Proc. Defaults to Riffer::Tools::Runtime::Inline.new.
118 119 120 |
# File 'lib/riffer/config.rb', line 118 def tool_runtime @tool_runtime end |