Module: LlmLogs

Defined in:
lib/llm_logs.rb,
lib/llm_logs/engine.rb,
lib/llm_logs/tracer.rb,
lib/llm_logs/version.rb,
app/models/llm_logs/span.rb,
app/models/llm_logs/batch.rb,
app/models/llm_logs/trace.rb,
app/models/llm_logs/prompt.rb,
lib/llm_logs/configuration.rb,
lib/llm_logs/prompt_renderer.rb,
app/jobs/llm_logs/batch/poll_job.rb,
app/jobs/llm_logs/batch/flush_job.rb,
app/models/llm_logs/batch_request.rb,
app/models/llm_logs/prompt_version.rb,
app/helpers/llm_logs/batches_helper.rb,
app/helpers/llm_logs/prompts_helper.rb,
app/models/llm_logs/batch/submitter.rb,
app/services/llm_logs/prompt_syncer.rb,
app/models/llm_logs/batch/reconciler.rb,
app/helpers/llm_logs/formatting_helper.rb,
app/models/llm_logs/application_record.rb,
app/models/llm_logs/batch/schema_format.rb,
app/models/llm_logs/batch/trace_recorder.rb,
app/controllers/llm_logs/spans_controller.rb,
lib/generators/llm_logs/install_generator.rb,
app/controllers/llm_logs/traces_controller.rb,
app/models/llm_logs/batch/handler_registry.rb,
lib/llm_logs/instrumentation/ruby_llm_chat.rb,
app/controllers/llm_logs/batches_controller.rb,
app/controllers/llm_logs/prompts_controller.rb,
app/controllers/llm_logs/application_controller.rb,
app/controllers/llm_logs/prompt_versions_controller.rb

Defined Under Namespace

Modules: BatchesHelper, FormattingHelper, Instrumentation, PromptsHelper, Tracer Classes: ApplicationController, ApplicationRecord, Batch, BatchRequest, BatchesController, Configuration, Engine, InstallGenerator, Prompt, PromptRenderer, PromptSyncer, PromptVersion, PromptVersionsController, PromptsController, Span, SpansController, Trace, TracesController

Constant Summary collapse

VERSION =
"0.2.2"

Class Method Summary collapse

Class Method Details

.auto_instrumentObject



25
26
27
# File 'lib/llm_logs.rb', line 25

def self.auto_instrument
  configuration.auto_instrument
end

.auto_instrument=(auto_instrument) ⇒ Object



29
30
31
# File 'lib/llm_logs.rb', line 29

def self.auto_instrument=(auto_instrument)
  configuration.auto_instrument = auto_instrument
end

.batch_enabled?Boolean

Returns:

  • (Boolean)


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

def self.batch_enabled?
  configuration.batch_enabled
end

.batch_handler(purpose) ⇒ Object



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

def self.batch_handler(purpose)
  LlmLogs::Batch::HandlerRegistry.resolve(purpose)
end

.batch_providerObject



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

def self.batch_provider
  configuration.batch_provider
end

.configurationObject



17
18
19
# File 'lib/llm_logs/configuration.rb', line 17

def self.configuration
  @configuration ||= Configuration.new
end

.enabledObject



17
18
19
# File 'lib/llm_logs.rb', line 17

def self.enabled
  configuration.enabled
end

.enabled=(enabled) ⇒ Object



21
22
23
# File 'lib/llm_logs.rb', line 21

def self.enabled=(enabled)
  configuration.enabled = enabled
end

.enabled?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/llm_logs.rb', line 13

def self.enabled?
  enabled
end

.register_batch_handler(purpose, handler) ⇒ Object



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

def self.register_batch_handler(purpose, handler)
  LlmLogs::Batch::HandlerRegistry.register(purpose, handler)
end

.retention_daysObject



33
34
35
# File 'lib/llm_logs.rb', line 33

def self.retention_days
  configuration.retention_days
end

.retention_days=(retention_days) ⇒ Object



37
38
39
# File 'lib/llm_logs.rb', line 37

def self.retention_days=(retention_days)
  configuration.retention_days = retention_days
end

.setup {|configuration| ... } ⇒ Object

Yields:



9
10
11
# File 'lib/llm_logs.rb', line 9

def self.setup
  yield configuration
end

.trace(name, **options, &block) ⇒ Object



57
58
59
# File 'lib/llm_logs.rb', line 57

def self.trace(name, **options, &block)
  LlmLogs::Tracer.start_trace(name, **options, &block)
end