Class: LlmCostTracker::Parsers::Base
- Inherits:
-
Object
- Object
- LlmCostTracker::Parsers::Base
- Defined in:
- lib/llm_cost_tracker/parsers/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#match?(url) ⇒ Boolean
Returns true if this parser can handle the given URL.
-
#parse(request_url, request_body, response_status, response_body) ⇒ LlmCostTracker::ParsedUsage?
Parse a provider response into a LlmCostTracker::ParsedUsage, or return nil when the response is not trackable (non-200, missing usage, etc).
Instance Method Details
#match?(url) ⇒ Boolean
Returns true if this parser can handle the given URL.
17 18 19 |
# File 'lib/llm_cost_tracker/parsers/base.rb', line 17 def match?(url) raise NotImplementedError end |
#parse(request_url, request_body, response_status, response_body) ⇒ LlmCostTracker::ParsedUsage?
Parse a provider response into a LlmCostTracker::ParsedUsage, or return nil when the response is not trackable (non-200, missing usage, etc).
12 13 14 |
# File 'lib/llm_cost_tracker/parsers/base.rb', line 12 def parse(request_url, request_body, response_status, response_body) raise NotImplementedError end |