Class: RubyLLM::Agents::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- RubyLLM::Agents::Engine
- Defined in:
- lib/ruby_llm/agents/rails/engine.rb
Overview
Rails Engine for RubyLLM::Agents
Provides a mountable dashboard for monitoring agent executions, with configurable authentication and automatic agent autoloading.
Class Method Summary collapse
-
.namespace_for_path(path, config) ⇒ Module?
private
Determines the namespace constant for a given path.
Class Method Details
.namespace_for_path(path, config) ⇒ Module?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Determines the namespace constant for a given path
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/ruby_llm/agents/rails/engine.rb', line 249 def self.namespace_for_path(path, config) parts = path.split("/") # Need at least app/{root_directory} return nil unless parts.length >= 2 && parts[0] == "app" return nil unless parts[1] == config.root_directory # app/agents -> no namespace (root level) return nil if parts.length == 2 # app/agents/embedders -> Embedders namespace subdirectory = parts[2] namespace_name = if config.root_namespace.blank? subdirectory.camelize else "#{config.root_namespace}::#{subdirectory.camelize}" end # Create the namespace module if needed namespace_name.constantize rescue NameError namespace_name.split("::").inject(Object) do |mod, name| mod.const_defined?(name, false) ? mod.const_get(name) : mod.const_set(name, Module.new) end end |