Class: Langfuse::PromptFetchResult
- Inherits:
-
Object
- Object
- Langfuse::PromptFetchResult
- Defined in:
- lib/langfuse/prompt_fetch_result.rb
Overview
Public metadata returned by prompt fetch operations.
Instance Attribute Summary collapse
-
#cache_status ⇒ Symbol
readonly
Cache status (:hit, :miss, :stale, :refresh, :bypass, :disabled).
-
#label ⇒ String?
readonly
Prompt label.
-
#logical_key ⇒ String
readonly
Stable logical cache identity.
-
#name ⇒ String
readonly
Prompt name.
-
#prompt ⇒ Object
readonly
Prompt data or prompt client returned by the fetch.
-
#source ⇒ Symbol
readonly
Source of the returned prompt (:cache, :api, :fallback).
-
#storage_key ⇒ String
readonly
Generated backend key for the current cache generation.
-
#version ⇒ Integer?
readonly
Prompt version.
Instance Method Summary collapse
-
#fallback? ⇒ Boolean
Whether this result used caller-provided fallback content.
-
#initialize(prompt:, logical_key:, storage_key:, cache_status:, source:, name:, version: nil, label: nil) ⇒ PromptFetchResult
constructor
rubocop:disable Metrics/ParameterLists.
-
#to_h ⇒ Hash
Result metadata as a hash.
Constructor Details
#initialize(prompt:, logical_key:, storage_key:, cache_status:, source:, name:, version: nil, label: nil) ⇒ PromptFetchResult
rubocop:disable Metrics/ParameterLists
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 40 def initialize(prompt:, logical_key:, storage_key:, cache_status:, source:, name:, version: nil, label: nil) @prompt = prompt @logical_key = logical_key @storage_key = storage_key @cache_status = cache_status @source = source @name = name @version = version @label = label end |
Instance Attribute Details
#cache_status ⇒ Symbol (readonly)
Returns Cache status (:hit, :miss, :stale, :refresh, :bypass, :disabled).
16 17 18 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 16 def cache_status @cache_status end |
#label ⇒ String? (readonly)
Returns Prompt label.
28 29 30 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 28 def label @label end |
#logical_key ⇒ String (readonly)
Returns Stable logical cache identity.
10 11 12 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 10 def logical_key @logical_key end |
#name ⇒ String (readonly)
Returns Prompt name.
22 23 24 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 22 def name @name end |
#prompt ⇒ Object (readonly)
Returns Prompt data or prompt client returned by the fetch.
7 8 9 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 7 def prompt @prompt end |
#source ⇒ Symbol (readonly)
Returns Source of the returned prompt (:cache, :api, :fallback).
19 20 21 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 19 def source @source end |
#storage_key ⇒ String (readonly)
Returns Generated backend key for the current cache generation.
13 14 15 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 13 def storage_key @storage_key end |
#version ⇒ Integer? (readonly)
Returns Prompt version.
25 26 27 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 25 def version @version end |
Instance Method Details
#fallback? ⇒ Boolean
Returns Whether this result used caller-provided fallback content.
53 54 55 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 53 def fallback? source == CacheSource::FALLBACK end |
#to_h ⇒ Hash
Returns Result metadata as a hash.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/langfuse/prompt_fetch_result.rb', line 58 def to_h { logical_key: logical_key, storage_key: storage_key, cache_status: cache_status, source: source, name: name, version: version, label: label, fallback: fallback? } end |