Package com.redis.vl.test.vcr
Enum Class VCRMode
- All Implemented Interfaces:
Serializable,Comparable<VCRMode>,Constable
VCR operating modes that determine how LLM calls are handled during tests.
Inspired by the Python VCR implementation in maestro-langgraph, this enum provides flexible options for recording and playing back LLM responses.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDisable VCR entirely.Use cached responses only.Smart mode: use cache if it exists, otherwise record.Always make real API calls and overwrite any existing cassettes.Re-record only tests that previously failed.Only record tests that are not already in the registry. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this mode can use cached responses.booleanChecks if this mode can potentially make real API calls and record responses.static VCRModeReturns the enum constant of this class with the specified name.static VCRMode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
PLAYBACK
Use cached responses only. Fails if no cassette exists for a call. This is the default mode for CI/CD environments where API calls should not be made. -
RECORD
Always make real API calls and overwrite any existing cassettes. Use this mode when re-recording all tests. -
RECORD_NEW
Only record tests that are not already in the registry. Existing cassettes are played back, new tests are recorded. -
RECORD_FAILED
Re-record only tests that previously failed. Successful tests use existing cassettes. -
PLAYBACK_OR_RECORD
Smart mode: use cache if it exists, otherwise record. Good for development when you want automatic recording of new tests. -
OFF
Disable VCR entirely. All calls go to real APIs, nothing is cached. Use this mode when testing real API behavior.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isRecordMode
public boolean isRecordMode()Checks if this mode can potentially make real API calls and record responses.- Returns:
- true if this mode can record new cassettes
-
isPlaybackMode
public boolean isPlaybackMode()Checks if this mode can use cached responses.- Returns:
- true if this mode can play back existing cassettes
-