Uses of Class
dev.langchain4j.test.mock.MockModerationModel
Packages that use MockModerationModel
Package
Description
Model mocks for tests: they need no network, answer the way a test tells them to, and record the requests they
receive.
-
Uses of MockModerationModel in dev.langchain4j.test.mock
Methods in dev.langchain4j.test.mock that return MockModerationModelModifier and TypeMethodDescriptionstatic MockModerationModelMockModerationModel.thatDoesNotFlag()A model that does not flag the first request.static MockModerationModelMockModerationModel.thatFails(RuntimeException exception) A model whose first request fails with exactly the given exception.static MockModerationModelA model that flags the first request, reporting the given text as the flagged one.static MockModerationModelMockModerationModel.thatModerates(Function<ModerationRequest, Moderation> moderation) A model that computes the moderation of the first request from the request.static MockModerationModelMockModerationModel.thatResponds(ModerationResponse response) A model that answers the first request with exactly the given response, including its metadata, to test code that reads it:MockModerationModel.thenDoesNotFlag()Adds a step: the next request is not flagged.MockModerationModel.thenFails(RuntimeException exception) Adds a step: the next request fails with exactly the given exception.Adds a step: the next request is flagged, with the given text reported as the flagged one.MockModerationModel.thenModerates(Function<ModerationRequest, Moderation> moderation) Adds a step: the moderation of the next request is computed from the request.MockModerationModel.thenRepeats()Answers every further request with the last step of the script.MockModerationModel.thenResponds(ModerationResponse response) Adds a step: the next request is answered with exactly the given response, including its metadata, seeMockModerationModel.thatResponds(ModerationResponse).MockModerationModel.withListeners(ModerationModelListener... listeners) Notifies the given listeners of each call, like a real model does.MockModerationModel.withListeners(List<ModerationModelListener> listeners) Notifies the given listeners of each call, like a real model does.