Class: DSPy::Registry::SignatureRegistry::SignatureVersion
- Inherits:
-
Object
- Object
- DSPy::Registry::SignatureRegistry::SignatureVersion
- Extended by:
- T::Sig
- Defined in:
- lib/dspy/registry/signature_registry.rb
Overview
Represents a versioned signature with deployment information
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#is_deployed ⇒ Object
readonly
Returns the value of attribute is_deployed.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#performance_score ⇒ Object
readonly
Returns the value of attribute performance_score.
-
#program_id ⇒ Object
readonly
Returns the value of attribute program_id.
-
#signature_name ⇒ Object
readonly
Returns the value of attribute signature_name.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#version_hash ⇒ Object
readonly
Returns the value of attribute version_hash.
Class Method Summary collapse
Instance Method Summary collapse
- #deploy ⇒ Object
-
#initialize(signature_name:, version:, configuration:, metadata: {}, program_id: nil, is_deployed: false, performance_score: nil) ⇒ SignatureVersion
constructor
A new instance of SignatureVersion.
- #to_h ⇒ Object
- #undeploy ⇒ Object
- #with_performance_score(score) ⇒ Object
Constructor Details
#initialize(signature_name:, version:, configuration:, metadata: {}, program_id: nil, is_deployed: false, performance_score: nil) ⇒ SignatureVersion
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/dspy/registry/signature_registry.rb', line 57 def initialize(signature_name:, version:, configuration:, metadata: {}, program_id: nil, is_deployed: false, performance_score: nil) @signature_name = signature_name @version = version @configuration = configuration.freeze = .merge({ created_at: Time.now.iso8601, registry_version: "1.0" }).freeze @created_at = Time.now @program_id = program_id @is_deployed = is_deployed @performance_score = performance_score @version_hash = generate_version_hash end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
29 30 31 |
# File 'lib/dspy/registry/signature_registry.rb', line 29 def configuration @configuration end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
35 36 37 |
# File 'lib/dspy/registry/signature_registry.rb', line 35 def created_at @created_at end |
#is_deployed ⇒ Object (readonly)
Returns the value of attribute is_deployed.
41 42 43 |
# File 'lib/dspy/registry/signature_registry.rb', line 41 def is_deployed @is_deployed end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
32 33 34 |
# File 'lib/dspy/registry/signature_registry.rb', line 32 def end |
#performance_score ⇒ Object (readonly)
Returns the value of attribute performance_score.
44 45 46 |
# File 'lib/dspy/registry/signature_registry.rb', line 44 def performance_score @performance_score end |
#program_id ⇒ Object (readonly)
Returns the value of attribute program_id.
38 39 40 |
# File 'lib/dspy/registry/signature_registry.rb', line 38 def program_id @program_id end |
#signature_name ⇒ Object (readonly)
Returns the value of attribute signature_name.
20 21 22 |
# File 'lib/dspy/registry/signature_registry.rb', line 20 def signature_name @signature_name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
23 24 25 |
# File 'lib/dspy/registry/signature_registry.rb', line 23 def version @version end |
#version_hash ⇒ Object (readonly)
Returns the value of attribute version_hash.
26 27 28 |
# File 'lib/dspy/registry/signature_registry.rb', line 26 def version_hash @version_hash end |
Class Method Details
.from_h(data) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/dspy/registry/signature_registry.rb', line 88 def self.from_h(data) version = new( signature_name: data[:signature_name], version: data[:version], configuration: data[:configuration] || {}, metadata: data[:metadata] || {}, program_id: data[:program_id], is_deployed: data[:is_deployed] || false, performance_score: data[:performance_score] ) version.instance_variable_set(:@created_at, Time.parse(data[:created_at])) if data[:created_at] version.instance_variable_set(:@version_hash, data[:version_hash]) if data[:version_hash] version end |
Instance Method Details
#deploy ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/dspy/registry/signature_registry.rb', line 117 def deploy self.class.new( signature_name: @signature_name, version: @version, configuration: @configuration, metadata: , program_id: @program_id, is_deployed: true, performance_score: @performance_score ) end |
#to_h ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/dspy/registry/signature_registry.rb', line 73 def to_h { signature_name: @signature_name, version: @version, version_hash: @version_hash, configuration: @configuration, metadata: , created_at: @created_at.iso8601, program_id: @program_id, is_deployed: @is_deployed, performance_score: @performance_score } end |
#undeploy ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/dspy/registry/signature_registry.rb', line 130 def undeploy self.class.new( signature_name: @signature_name, version: @version, configuration: @configuration, metadata: , program_id: @program_id, is_deployed: false, performance_score: @performance_score ) end |
#with_performance_score(score) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/dspy/registry/signature_registry.rb', line 104 def with_performance_score(score) self.class.new( signature_name: @signature_name, version: @version, configuration: @configuration, metadata: , program_id: @program_id, is_deployed: @is_deployed, performance_score: score ) end |