Class: Langfuse::Models::Generation
- Inherits:
-
Object
- Object
- Langfuse::Models::Generation
- Defined in:
- lib/langfuse/models/generation.rb
Instance Attribute Summary collapse
-
#completion_start_time ⇒ Object
Returns the value of attribute completion_start_time.
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#id ⇒ Object
Returns the value of attribute id.
-
#input ⇒ Object
Returns the value of attribute input.
-
#level ⇒ Object
Returns the value of attribute level.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#model ⇒ Object
Returns the value of attribute model.
-
#model_parameters ⇒ Object
Returns the value of attribute model_parameters.
-
#name ⇒ Object
Returns the value of attribute name.
-
#output ⇒ Object
Returns the value of attribute output.
-
#parent_observation_id ⇒ Object
Returns the value of attribute parent_observation_id.
-
#prompt_name ⇒ Object
Returns the value of attribute prompt_name.
-
#prompt_version ⇒ Object
Returns the value of attribute prompt_version.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#status_message ⇒ Object
Returns the value of attribute status_message.
-
#trace_id ⇒ Object
Returns the value of attribute trace_id.
-
#usage ⇒ Object
Returns the value of attribute usage.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Generation
constructor
A new instance of Generation.
- #to_h ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Generation
Returns a new instance of Generation.
12 13 14 15 16 17 18 |
# File 'lib/langfuse/models/generation.rb', line 12 def initialize(attributes = {}) attributes.each do |key, value| send("#{key}=", value) if respond_to?("#{key}=") end @id ||= SecureRandom.uuid @start_time ||= Time.now.utc end |
Instance Attribute Details
#completion_start_time ⇒ Object
Returns the value of attribute completion_start_time.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def completion_start_time @completion_start_time end |
#end_time ⇒ Object
Returns the value of attribute end_time.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def end_time @end_time end |
#environment ⇒ Object
Returns the value of attribute environment.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def environment @environment end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def id @id end |
#input ⇒ Object
Returns the value of attribute input.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def input @input end |
#level ⇒ Object
Returns the value of attribute level.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def level @level end |
#metadata ⇒ Object
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def @metadata end |
#model ⇒ Object
Returns the value of attribute model.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def model @model end |
#model_parameters ⇒ Object
Returns the value of attribute model_parameters.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def model_parameters @model_parameters end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def name @name end |
#output ⇒ Object
Returns the value of attribute output.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def output @output end |
#parent_observation_id ⇒ Object
Returns the value of attribute parent_observation_id.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def parent_observation_id @parent_observation_id end |
#prompt_name ⇒ Object
Returns the value of attribute prompt_name.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def prompt_name @prompt_name end |
#prompt_version ⇒ Object
Returns the value of attribute prompt_version.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def prompt_version @prompt_version end |
#start_time ⇒ Object
Returns the value of attribute start_time.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def start_time @start_time end |
#status_message ⇒ Object
Returns the value of attribute status_message.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def @status_message end |
#trace_id ⇒ Object
Returns the value of attribute trace_id.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def trace_id @trace_id end |
#usage ⇒ Object
Returns the value of attribute usage.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def usage @usage end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/langfuse/models/generation.rb', line 6 def version @version end |
Instance Method Details
#to_h ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/langfuse/models/generation.rb', line 20 def to_h { id: @id, traceId: @trace_id, name: @name, startTime: @start_time&.iso8601(3), endTime: @end_time&.iso8601(3), metadata: @metadata, input: @input, output: @output, level: @level, statusMessage: @status_message, parentObservationId: @parent_observation_id, version: @version, environment: @environment, completionStartTime: @completion_start_time&.iso8601(3), model: @model, modelParameters: @model_parameters, usage: @usage.respond_to?(:to_h) ? @usage.to_h : @usage, promptName: @prompt_name, promptVersion: @prompt_version }.compact end |