ReqLLM.Step.Fixture (ReqLLM v1.0.0)
View SourceReq step that attaches test fixture functionality when running in test environments.
This step:
- Conditionally attaches fixture steps based on the
:fixtureoption - Only activates when the Fixture module is available (test environment)
- Normalizes fixture tuples to
{provider, name}format - No-ops gracefully when fixtures aren't available
Usage
request
|> ReqLLM.Step.Fixture.attach(model, opts)Options
:fixture- Can be:nil- No fixture attached (default)"fixture_name"- Uses model's provider with given name{:provider, "fixture_name"}- Explicit provider and name tuple
Summary
Functions
Attaches the Fixture step to a Req request if fixture option is present.
Functions
@spec maybe_attach(Req.Request.t(), ReqLLM.Model.t(), keyword()) :: Req.Request.t()
Attaches the Fixture step to a Req request if fixture option is present.
Parameters
req- The Req.Request structmodel- ReqLLM.Model struct for provider detectionopts- Options keyword list containing potential:fixtureoption
Examples
request
|> ReqLLM.Step.Fixture.maybe_attach(model, fixture: "test_response")
request
|> ReqLLM.Step.Fixture.maybe_attach(model, fixture: {:openai, "chat_completion"})