Class: Langfuse::Models::Trace

Inherits:
Object
  • Object
show all
Defined in:
lib/langfuse/models/trace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Trace

Returns a new instance of Trace.



10
11
12
13
14
15
16
# File 'lib/langfuse/models/trace.rb', line 10

def initialize(attributes = {})
  attributes.each do |key, value|
    send("#{key}=", value) if respond_to?("#{key}=")
  end
  @id ||= SecureRandom.uuid
  @timestamp ||= Time.now.utc
end

Instance Attribute Details

#environmentObject

Returns the value of attribute environment.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def environment
  @environment
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def id
  @id
end

#inputObject

Returns the value of attribute input.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def input
  @input
end

#metadataObject

Returns the value of attribute metadata.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def 
  
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def name
  @name
end

#outputObject

Returns the value of attribute output.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def output
  @output
end

#publicObject

Returns the value of attribute public.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def public
  @public
end

#releaseObject

Returns the value of attribute release.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def release
  @release
end

#session_idObject

Returns the value of attribute session_id.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def session_id
  @session_id
end

#tagsObject

Returns the value of attribute tags.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def tags
  @tags
end

#timestampObject

Returns the value of attribute timestamp.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def timestamp
  @timestamp
end

#user_idObject

Returns the value of attribute user_id.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def user_id
  @user_id
end

#versionObject

Returns the value of attribute version.



6
7
8
# File 'lib/langfuse/models/trace.rb', line 6

def version
  @version
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/langfuse/models/trace.rb', line 18

def to_h
  {
    id: @id,
    name: @name,
    userId: @user_id,
    input: @input,
    output: @output,
    sessionId: @session_id,
    metadata: ,
    tags: @tags,
    public: @public,
    release: @release,
    version: @version,
    timestamp: @timestamp&.iso8601(3),
    environment: @environment
  }.compact
end