Class: LlmCassette::Recorder
- Inherits:
-
Object
- Object
- LlmCassette::Recorder
- Defined in:
- lib/llm_cassette/recorder.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(env, app, cassette) ⇒ Recorder
constructor
A new instance of Recorder.
Constructor Details
#initialize(env, app, cassette) ⇒ Recorder
Returns a new instance of Recorder.
5 6 7 8 9 |
# File 'lib/llm_cassette/recorder.rb', line 5 def initialize(env, app, cassette) @env = env @app = app @cassette = cassette end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/llm_cassette/recorder.rb', line 11 def call request_body = @env.body.dup.to_s streaming = !@env.request.on_data.nil? chunks = intercept_streaming([], streaming) response = @app.call(@env) record(request_body, streaming, chunks, response) response end |