Module: LlmCostTracker::TagAccessors

Included in:
LlmApiCall
Defined in:
lib/llm_cost_tracker/tag_accessors.rb

Instance Method Summary collapse

Instance Method Details

#parsed_tagsObject



7
8
9
10
11
12
13
# File 'lib/llm_cost_tracker/tag_accessors.rb', line 7

def parsed_tags
  return tags.transform_keys(&:to_s) if tags.is_a?(Hash)

  JSON.parse(tags || "{}")
rescue JSON::ParserError
  {}
end