Module: RubyLLM::Ups

Defined in:
lib/ruby_llm/ups.rb,
lib/ruby_llm/ups/client.rb,
lib/ruby_llm/ups/errors.rb,
lib/ruby_llm/ups/monitor.rb,
lib/ruby_llm/ups/railtie.rb,
lib/ruby_llm/ups/version.rb,
lib/ruby_llm/ups/monitored.rb,
lib/ruby_llm/ups/configuration.rb,
lib/ruby_llm/ups/async_reporter.rb,
lib/ruby_llm/ups/incident_methods.rb,
lib/ruby_llm/ups/component_registry.rb

Defined Under Namespace

Modules: IncidentMethods, Monitored Classes: ApiError, AsyncReporter, AuthenticationError, Client, ComponentRegistry, Configuration, ConfigurationError, Error, Monitor, NotFoundError, Railtie, RateLimitError

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.client ⇒ Object



27
28
29
# File 'lib/ruby_llm/ups.rb', line 27

def client
  @client ||= Client.new(config)
end

.component_registry ⇒ Object



31
32
33
# File 'lib/ruby_llm/ups.rb', line 31

def component_registry
  @component_registry ||= ComponentRegistry.new(client)
end

.config ⇒ Object



23
24
25
# File 'lib/ruby_llm/ups.rb', line 23

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



16
17
18
19
20
21
# File 'lib/ruby_llm/ups.rb', line 16

def configure
  yield config
  @client = nil # reset client on reconfigure
  @async_reporter = nil
  @component_registry = nil
end

.create_incident(title:, impact:, status: :investigating, **attrs) ⇒ Object



47
48
49
# File 'lib/ruby_llm/ups.rb', line 47

def create_incident(title:, impact:, status: :investigating, **attrs)
  client.create_incident(title: title, impact: impact, status: status, **attrs)
end

.monitor(chat_or_agent, component_id: nil) ⇒ Object



35
36
37
38
39
40
# File 'lib/ruby_llm/ups.rb', line 35

def monitor(chat_or_agent, component_id: nil)
  cid = resolve_component_id!(component_id)
  Monitor.new(chat_or_agent, component_id: cid, client: client,
                             async_reporter: config.async ? async_reporter : nil)
  chat_or_agent
end

.report_status(status, component_id: nil, agent_metadata: {}) ⇒ Object



42
43
44
45
# File 'lib/ruby_llm/ups.rb', line 42

def report_status(status, component_id: nil, agent_metadata: {})
  cid = resolve_component_id!(component_id)
  client.update_component(cid, status: status, agent_metadata: )
end

.reset! ⇒ Object



59
60
61
62
63
64
65
# File 'lib/ruby_llm/ups.rb', line 59

def reset!
  @async_reporter&.shutdown
  @config = nil
  @client = nil
  @async_reporter = nil
  @component_registry = nil
end

.resolve_incident(id) ⇒ Object



55
56
57
# File 'lib/ruby_llm/ups.rb', line 55

def resolve_incident(id)
  client.resolve_incident(id)
end

.update_incident(id, **attrs) ⇒ Object



51
52
53
# File 'lib/ruby_llm/ups.rb', line 51

def update_incident(id, **attrs)
  client.update_incident(id, **attrs)
end