Enum Class VCRMode

java.lang.Object
java.lang.Enum<VCRMode>
com.redis.vl.test.vcr.VCRMode
All Implemented Interfaces:
Serializable, Comparable<VCRMode>, Constable

public enum VCRMode extends Enum<VCRMode>
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.

  • Enum Constant Details

    • PLAYBACK

      public static final VCRMode 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

      public static final VCRMode RECORD
      Always make real API calls and overwrite any existing cassettes. Use this mode when re-recording all tests.
    • RECORD_NEW

      public static final VCRMode RECORD_NEW
      Only record tests that are not already in the registry. Existing cassettes are played back, new tests are recorded.
    • RECORD_FAILED

      public static final VCRMode RECORD_FAILED
      Re-record only tests that previously failed. Successful tests use existing cassettes.
    • PLAYBACK_OR_RECORD

      public static final VCRMode PLAYBACK_OR_RECORD
      Smart mode: use cache if it exists, otherwise record. Good for development when you want automatic recording of new tests.
    • OFF

      public static final VCRMode OFF
      Disable VCR entirely. All calls go to real APIs, nothing is cached. Use this mode when testing real API behavior.
  • Method Details

    • values

      public static VCRMode[] 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

      public static VCRMode valueOf(String name)
      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 name
      NullPointerException - 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