Class: Langfuse::PromptCacheKey
- Inherits:
-
Object
- Object
- Langfuse::PromptCacheKey
- Defined in:
- lib/langfuse/prompt_fetch_result.rb
Overview
Public key inspection result for prompt cache operations.
Instance Attribute Summary collapse
-
#label ⇒ String?
readonly
Prompt label.
-
#logical_key ⇒ String
readonly
Stable logical cache identity.
-
#name ⇒ String
readonly
Prompt name.
-
#storage_key ⇒ String
readonly
Generated backend key for the current cache generation.
-
#version ⇒ Integer?
readonly
Prompt version.
Instance Method Summary collapse
- #initialize(name:, logical_key:, storage_key:, version: nil, label: nil) ⇒ PromptCacheKey constructor
-
#resolved_label ⇒ String?
Resolve the effective label, defaulting to “production” when neither an explicit label nor a version was specified.
-
#to_h ⇒ Hash
Cache key data as a hash.
Constructor Details
#initialize(name:, logical_key:, storage_key:, version: nil, label: nil) ⇒ PromptCacheKey
95 96 97 98 99 100 101 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 95 def initialize(name:, logical_key:, storage_key:, version: nil, label: nil) @name = name @version = version @label = label @logical_key = logical_key @storage_key = storage_key end |
Instance Attribute Details
#label ⇒ String? (readonly)
Returns Prompt label.
81 82 83 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 81 def label @label end |
#logical_key ⇒ String (readonly)
Returns Stable logical cache identity.
84 85 86 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 84 def logical_key @logical_key end |
#name ⇒ String (readonly)
Returns Prompt name.
75 76 77 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 75 def name @name end |
#storage_key ⇒ String (readonly)
Returns Generated backend key for the current cache generation.
87 88 89 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 87 def storage_key @storage_key end |
#version ⇒ Integer? (readonly)
Returns Prompt version.
78 79 80 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 78 def version @version end |
Instance Method Details
#resolved_label ⇒ String?
Resolve the effective label, defaulting to “production” when neither an explicit label nor a version was specified.
107 108 109 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 107 def resolved_label label || (version ? nil : "production") end |
#to_h ⇒ Hash
Returns Cache key data as a hash.
112 113 114 115 116 117 118 119 120 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 112 def to_h { name: name, version: version, label: label, logical_key: logical_key, storage_key: storage_key } end |