Module: LlmCostTracker::TagAccessors

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

Instance Method Summary collapse

Instance Method Details

#featureObject



15
16
17
# File 'lib/llm_cost_tracker/tag_accessors.rb', line 15

def feature
  parsed_tags["feature"]
end

#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

#user_idObject



19
20
21
# File 'lib/llm_cost_tracker/tag_accessors.rb', line 19

def user_id
  parsed_tags["user_id"]
end