Class: NitroIntelligence::AssistantRegistry
- Inherits:
-
Object
- Object
- NitroIntelligence::AssistantRegistry
- Defined in:
- lib/nitro_intelligence/assistant_registry.rb
Overview
Assistants addressable by name.
NitroIntelligence.assistants["candidate-concierge"].await_run(...)
Built from assistants_config: connection settings shared by every assistant sit at the
top level, and each entry under definitions overrides them where it needs to. The key an
entry is filed under is what it is looked up by, distinct from any name it carries.
{
"base_url" => "https://nip-assistants.example.com",
"user_id" => "nitro-web",
"definitions" => {
"candidate-concierge" => { "graph_id" => "react-agent" },
},
}
Defined Under Namespace
Classes: UnknownAssistantError
Constant Summary collapse
- DEFINITIONS_KEY =
"definitions".freeze
- SHARED_KEYS =
%w[base_url user_id].freeze
Instance Method Summary collapse
- #[](key) ⇒ Object
- #fetch(key) ⇒ Object
-
#initialize(config = {}) ⇒ AssistantRegistry
constructor
A new instance of AssistantRegistry.
- #key?(key) ⇒ Boolean
- #keys ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ AssistantRegistry
Returns a new instance of AssistantRegistry.
25 26 27 28 |
# File 'lib/nitro_intelligence/assistant_registry.rb', line 25 def initialize(config = {}) @config = config.to_h.deep_stringify_keys @assistants = {} end |
Instance Method Details
#[](key) ⇒ Object
30 31 32 |
# File 'lib/nitro_intelligence/assistant_registry.rb', line 30 def [](key) fetch(key) end |
#fetch(key) ⇒ Object
34 35 36 37 |
# File 'lib/nitro_intelligence/assistant_registry.rb', line 34 def fetch(key) key = key.to_s @assistants[key] ||= build(key) end |
#key?(key) ⇒ Boolean
39 40 41 |
# File 'lib/nitro_intelligence/assistant_registry.rb', line 39 def key?(key) definitions.key?(key.to_s) end |
#keys ⇒ Object
43 44 45 |
# File 'lib/nitro_intelligence/assistant_registry.rb', line 43 def keys definitions.keys end |