Class ScriptedChatModel.Builder
java.lang.Object
io.micronaut.langchain4j.test.ScriptedChatModel.Builder
- Enclosing class:
ScriptedChatModel
Builds the rules of a
ScriptedChatModel, evaluated in order.- Since:
- 2.4.0
-
Method Summary
-
Method Details
-
when
public ScriptedChatModel.Answer when(Predicate<dev.langchain4j.model.chat.request.ChatRequest> condition) - Parameters:
condition- The condition of the rule- Returns:
- The answer of the rule
-
whenUserMessageContains
- Parameters:
text- The text to look for- Returns:
- The answer to the requests whose last user message contains the text
-
whenToolResult
- Returns:
- The answer to the requests that end with the result of a tool execution
-
otherwise
- Parameters:
response- The response to the requests that match no other rule- Returns:
- The builder
-
otherwise
public ScriptedChatModel.Builder otherwise(Function<dev.langchain4j.model.chat.request.ChatRequest, String> response) - Parameters:
response- The response to the requests that match no other rule- Returns:
- The builder
-
build
- Returns:
- The chat model
-