Class: Vellum::InitiatedPromptExecutionMeta

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/initiated_prompt_execution_meta.rb

Overview

The subset of the metadata tracked by Vellum during prompt execution that the request opted into with ‘expand_meta`.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_name: nil, latency: nil, deployment_release_tag: nil, prompt_version_id: nil, additional_properties: nil) ⇒ InitiatedPromptExecutionMeta

Parameters:

  • model_name (String) (defaults to: nil)
  • latency (Integer) (defaults to: nil)
  • deployment_release_tag (String) (defaults to: nil)
  • prompt_version_id (String) (defaults to: nil)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vellum_ai/types/initiated_prompt_execution_meta.rb', line 16

def initialize(model_name: nil, latency: nil, deployment_release_tag: nil, prompt_version_id: nil,
               additional_properties: nil)
  # @type [String]
  @model_name = model_name
  # @type [Integer]
  @latency = latency
  # @type [String]
  @deployment_release_tag = deployment_release_tag
  # @type [String]
  @prompt_version_id = prompt_version_id
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



8
9
10
# File 'lib/vellum_ai/types/initiated_prompt_execution_meta.rb', line 8

def additional_properties
  @additional_properties
end

#deployment_release_tagObject (readonly)

Returns the value of attribute deployment_release_tag.



8
9
10
# File 'lib/vellum_ai/types/initiated_prompt_execution_meta.rb', line 8

def deployment_release_tag
  @deployment_release_tag
end

#latencyObject (readonly)

Returns the value of attribute latency.



8
9
10
# File 'lib/vellum_ai/types/initiated_prompt_execution_meta.rb', line 8

def latency
  @latency
end

#model_nameObject (readonly)

Returns the value of attribute model_name.



8
9
10
# File 'lib/vellum_ai/types/initiated_prompt_execution_meta.rb', line 8

def model_name
  @model_name
end

#prompt_version_idObject (readonly)

Returns the value of attribute prompt_version_id.



8
9
10
# File 'lib/vellum_ai/types/initiated_prompt_execution_meta.rb', line 8

def prompt_version_id
  @prompt_version_id
end

Class Method Details

.from_json(json_object:) ⇒ InitiatedPromptExecutionMeta

Deserialize a JSON object to an instance of InitiatedPromptExecutionMeta

Parameters:

  • json_object (JSON)

Returns:



34
35
36
37
38
39
40
41
42
43
# File 'lib/vellum_ai/types/initiated_prompt_execution_meta.rb', line 34

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  JSON.parse(json_object)
  model_name = struct.model_name
  latency = struct.latency
  deployment_release_tag = struct.deployment_release_tag
  prompt_version_id = struct.prompt_version_id
  new(model_name: model_name, latency: latency, deployment_release_tag: deployment_release_tag,
      prompt_version_id: prompt_version_id, additional_properties: struct)
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


61
62
63
64
65
66
# File 'lib/vellum_ai/types/initiated_prompt_execution_meta.rb', line 61

def self.validate_raw(obj:)
  obj.model_name&.is_a?(String) != false || raise("Passed value for field obj.model_name is not the expected type, validation failed.")
  obj.latency&.is_a?(Integer) != false || raise("Passed value for field obj.latency is not the expected type, validation failed.")
  obj.deployment_release_tag&.is_a?(String) != false || raise("Passed value for field obj.deployment_release_tag is not the expected type, validation failed.")
  obj.prompt_version_id&.is_a?(String) != false || raise("Passed value for field obj.prompt_version_id is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of InitiatedPromptExecutionMeta to a JSON object

Returns:

  • (JSON)


48
49
50
51
52
53
54
55
# File 'lib/vellum_ai/types/initiated_prompt_execution_meta.rb', line 48

def to_json(*_args)
  {
    "model_name": @model_name,
    "latency": @latency,
    "deployment_release_tag": @deployment_release_tag,
    "prompt_version_id": @prompt_version_id
  }.to_json
end