Module: RubyLlmMesh

Defined in:
lib/ruby_llm_mesh.rb,
lib/ruby_llm_mesh/budget.rb,
lib/ruby_llm_mesh/errors.rb,
lib/ruby_llm_mesh/router.rb,
lib/ruby_llm_mesh/railtie.rb,
lib/ruby_llm_mesh/version.rb,
lib/ruby_llm_mesh/response.rb,
lib/ruby_llm_mesh/rag/tools.rb,
lib/ruby_llm_mesh/native_core.rb,
lib/ruby_llm_mesh/rag/chunker.rb,
lib/ruby_llm_mesh/configuration.rb,
lib/ruby_llm_mesh/providers/base.rb,
lib/ruby_llm_mesh/rag/embeddings.rb,
lib/ruby_llm_mesh/sovereign_mesh.rb,
lib/ruby_llm_mesh/circuit_breaker.rb,
lib/ruby_llm_mesh/providers/openai.rb,
lib/ruby_llm_mesh/cache/redis_store.rb,
lib/ruby_llm_mesh/cache/memory_store.rb,
lib/ruby_llm_mesh/mesh/peer_registry.rb,
lib/ruby_llm_mesh/mesh/health_monitor.rb,
lib/ruby_llm_mesh/providers/anthropic.rb,
lib/ruby_llm_mesh/cache/semantic_cache.rb,
lib/ruby_llm_mesh/providers/local_node.rb,
lib/ruby_llm_mesh/active_record/acts_as_ai_agent.rb,
sig/ruby_llm_mesh.rbs

Defined Under Namespace

Modules: ActiveRecord, Cache, Mesh, NativeCore, Providers, Rag Classes: AllProvidersFailedError, AuthenticationError, Budget, BudgetExceededError, CircuitBreaker, CircuitOpenError, Configuration, ConfigurationError, Error, ProviderError, Railtie, RateLimitError, Response, Router, SovereignMesh, TimeoutError

Constant Summary collapse

VERSION =

Returns:

  • (String)
"2.2.0"

Class Method Summary collapse

Class Method Details

.boot_mesh!(port: configuration.mesh_port) ⇒ Boolean

Parameters:

  • port: (Integer) (defaults to: configuration.mesh_port)

Returns:

  • (Boolean)


45
46
47
# File 'lib/ruby_llm_mesh.rb', line 45

def boot_mesh!(port: configuration.mesh_port)
  NativeCore.start_node(port)
end

.budget_statusObject



53
54
55
# File 'lib/ruby_llm_mesh.rb', line 53

def budget_status
  Budget.instance(config: configuration).status
end

.chatResponse

Parameters:

  • (Object)

Returns:



36
37
38
# File 'lib/ruby_llm_mesh.rb', line 36

def chat(**)
  complete(**)
end

.complete(prompt:, providers: nil, fallback: nil, **options) ⇒ Object



32
33
34
# File 'lib/ruby_llm_mesh.rb', line 32

def complete(prompt:, providers: nil, fallback: nil, **options)
  Router.new.complete(prompt: prompt, providers: providers, fallback: fallback, **options)
end

.configurationConfiguration

Returns:



87
88
89
# File 'lib/ruby_llm_mesh/configuration.rb', line 87

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ void

This method returns an undefined value.

Yields:

Yield Parameters:

Yield Returns:

  • (void)


91
92
93
# File 'lib/ruby_llm_mesh/configuration.rb', line 91

def configure
  yield configuration
end

.execute(intent:, strategy: :auto, **options) ⇒ Response

Sovereign mesh entrypoint — native P2P and/or real cloud failover.

Parameters:

  • intent: (String)
  • strategy: (Symbol) (defaults to: :auto)
  • (Object)

Returns:



41
42
43
# File 'lib/ruby_llm_mesh.rb', line 41

def execute(intent:, strategy: :auto, **options)
  SovereignMesh.new.execute(intent: intent, strategy: strategy, **options)
end

.mesh_alive?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/ruby_llm_mesh.rb', line 49

def mesh_alive?
  NativeCore.node_alive?
end

.reset_configuration!void

This method returns an undefined value.



95
96
97
98
99
100
101
102
# File 'lib/ruby_llm_mesh/configuration.rb', line 95

def reset_configuration!
  NativeCore.reset! if defined?(NativeCore)
  @configuration = Configuration.new
  Cache::SemanticCache.reset! if defined?(Cache::SemanticCache)
  Mesh::PeerRegistry.reset! if defined?(Mesh::PeerRegistry)
  Mesh::HealthMonitor.reset! if defined?(Mesh::HealthMonitor)
  Budget.reset! if defined?(Budget)
end