Class VCRModelWrapper

java.lang.Object
com.redis.vl.test.vcr.VCRModelWrapper

public final class VCRModelWrapper extends Object
Utility class for wrapping model instances with VCR interceptors.

This class provides methods to wrap various LLM model types (LangChain4J, Spring AI) with their corresponding VCR wrappers.

  • Method Details

    • wrapField

      public static boolean wrapField(Object testInstance, Field field, String testId, VCRMode mode, String modelName, VCRCassetteStore cassetteStore)
      Wraps a model field with the appropriate VCR interceptor.
      Parameters:
      testInstance - the test instance containing the field
      field - the field to wrap
      testId - the current test identifier
      mode - the VCR mode
      modelName - optional model name for the wrapper
      cassetteStore - the cassette store for persistence
      Returns:
      true if the field was wrapped, false otherwise
    • wrapModel

      public static Object wrapModel(Object model, String testId, VCRMode mode, String modelName, VCRCassetteStore cassetteStore)
      Wraps a model with the appropriate VCR interceptor based on its type.
      Parameters:
      model - the model to wrap
      testId - the test identifier
      mode - the VCR mode
      modelName - the model name for cache keys
      cassetteStore - the cassette store for persistence
      Returns:
      the wrapped model, or null if the model type is not supported