Package com.redis.vl.test.vcr
Class VCRModelWrapper
java.lang.Object
com.redis.vl.test.vcr.VCRModelWrapper
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 Summary
Modifier and TypeMethodDescriptionstatic booleanwrapField(Object testInstance, Field field, String testId, VCRMode mode, String modelName, VCRCassetteStore cassetteStore) Wraps a model field with the appropriate VCR interceptor.static ObjectwrapModel(Object model, String testId, VCRMode mode, String modelName, VCRCassetteStore cassetteStore) Wraps a model with the appropriate VCR interceptor based on its type.
-
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 fieldfield- the field to wraptestId- the current test identifiermode- the VCR modemodelName- optional model name for the wrappercassetteStore- 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 wraptestId- the test identifiermode- the VCR modemodelName- the model name for cache keyscassetteStore- the cassette store for persistence- Returns:
- the wrapped model, or null if the model type is not supported
-