Class: LlmCostTracker::Parsers::Base
- Inherits:
-
Object
- Object
- LlmCostTracker::Parsers::Base
- Defined in:
- lib/llm_cost_tracker/parsers/base.rb
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) ⇒ Object
Returns a hash with parsed usage data, or nil if not applicable.
Instance Method Details
#match?(url) ⇒ Boolean
Returns true if this parser can handle the given URL.
20 21 22 |
# File 'lib/llm_cost_tracker/parsers/base.rb', line 20 def match?(url) raise NotImplementedError end |
#parse(request_url, request_body, response_status, response_body) ⇒ Object
Returns a hash with parsed usage data, or nil if not applicable.
Expected return format:
provider: "openai",
model: "gpt-4o",
input_tokens: 150,
output_tokens: 42
15 16 17 |
# File 'lib/llm_cost_tracker/parsers/base.rb', line 15 def parse(request_url, request_body, response_status, response_body) raise NotImplementedError end |