Class: Langfuse::Score

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Score

Returns a new instance of Score.



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/langfuse/evaluation.rb', line 35

def initialize(data)
  @data = data.is_a?(Hash) ? Utils.deep_symbolize_keys(data) : data

  @id = @data[:id]
  @name = @data[:name]
  @value = @data[:value]
  @data_type = @data[:data_type]
  @comment = @data[:comment]
  @trace_id = @data[:trace_id]
  @observation_id = @data[:observation_id]
  @created_at = @data[:created_at]
end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



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

def comment
  @comment
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#data_typeObject (readonly)

Returns the value of attribute data_type.



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

def data_type
  @data_type
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#observation_idObject (readonly)

Returns the value of attribute observation_id.



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

def observation_id
  @observation_id
end

#trace_idObject (readonly)

Returns the value of attribute trace_id.



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

def trace_id
  @trace_id
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#to_dictObject



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/langfuse/evaluation.rb', line 48

def to_dict
  {
    id: @id,
    name: @name,
    value: @value,
    data_type: @data_type,
    comment: @comment,
    trace_id: @trace_id,
    observation_id: @observation_id,
    created_at: @created_at
  }.compact
end