Uses of Class
dev.langchain4j.test.mock.MockScoringModel
Packages that use MockScoringModel
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 MockScoringModel in dev.langchain4j.test.mock
Methods in dev.langchain4j.test.mock that return MockScoringModelModifier and TypeMethodDescriptionstatic MockScoringModelMockScoringModel.thatFails(RuntimeException exception) A model whose first request fails with exactly the given exception, also a request without documents.static MockScoringModelMockScoringModel.thatResponds(ScoringResponse response) A model that answers the first request with exactly the given response, including its metadata, for example its token usage or model name, to test code that reads them, such as a cost check:static MockScoringModelMockScoringModel.thatScores(double score) A model that answers the first request with the given score for every document.static MockScoringModelMockScoringModel.thatScores(ToDoubleFunction<String> scores) A model that answers the first request with the score computed from the text of each document.MockScoringModel.thenFails(RuntimeException exception) Adds a step: the next request fails with exactly the given exception, also a request without documents.MockScoringModel.thenRepeats()Answers every further request with the last step of the script.MockScoringModel.thenResponds(ScoringResponse response) Adds a step: the next request is answered with exactly the given response, including its metadata, seeMockScoringModel.thatResponds(ScoringResponse).MockScoringModel.thenScores(double score) Adds a step: every document of the next request gets the given score.MockScoringModel.thenScores(ToDoubleFunction<String> scores) Adds a step: every document of the next request gets the score computed from its text.MockScoringModel.withListeners(ScoringModelListener... listeners) Notifies the given listeners of each call, like a real model does.MockScoringModel.withListeners(List<ScoringModelListener> listeners) Notifies the given listeners of each call, like a real model does.