Module: LangsmithrbRails::LangSmith

Defined in:
lib/langsmithrb_rails/langsmith.rb

Overview

LangSmith integration for Rails applications using the langsmithrb gem

Class Method Summary collapse

Class Method Details

.configure(api_key:, project_name: nil, tracing: true) ⇒ Object

Configure LangSmith tracing This method sets up LangSmith tracing using the langsmithrb gem



14
15
16
17
18
19
20
# File 'lib/langsmithrb_rails/langsmith.rb', line 14

def configure(api_key:, project_name: nil, tracing: true)
  Langsmithrb.configure do |config|
    config.api_key = api_key
    config.project_name = project_name if project_name
    config.tracing_enabled = tracing
  end
end

.enabled?Boolean

Check if LangSmith tracing is enabled



24
25
26
# File 'lib/langsmithrb_rails/langsmith.rb', line 24

def enabled?
  Langsmithrb.config.tracing_enabled && !Langsmithrb.config.api_key.nil?
end

.project_nameString?

Get the current LangSmith project name



30
31
32
# File 'lib/langsmithrb_rails/langsmith.rb', line 30

def project_name
  Langsmithrb.config.project_name
end