Class: Langfuse::Evaluation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Evaluation

Returns a new instance of Evaluation.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/langfuse/evaluation.rb', line 5

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.



3
4
5
# File 'lib/langfuse/evaluation.rb', line 3

def comment
  @comment
end

#created_atObject (readonly)

Returns the value of attribute created_at.



3
4
5
# File 'lib/langfuse/evaluation.rb', line 3

def created_at
  @created_at
end

#data_typeObject (readonly)

Returns the value of attribute data_type.



3
4
5
# File 'lib/langfuse/evaluation.rb', line 3

def data_type
  @data_type
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/langfuse/evaluation.rb', line 3

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/langfuse/evaluation.rb', line 3

def name
  @name
end

#observation_idObject (readonly)

Returns the value of attribute observation_id.



3
4
5
# File 'lib/langfuse/evaluation.rb', line 3

def observation_id
  @observation_id
end

#trace_idObject (readonly)

Returns the value of attribute trace_id.



3
4
5
# File 'lib/langfuse/evaluation.rb', line 3

def trace_id
  @trace_id
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/langfuse/evaluation.rb', line 3

def value
  @value
end

Instance Method Details

#to_dictObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/langfuse/evaluation.rb', line 18

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