Interface PrintMessageHandler
- All Superinterfaces:
PrintAdvanceMessageHandler
Represents a PrintMessageHandler.
The Core uses this to print messages to the user or API Clients.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancolor()Gets if color is supported by the PrintMessageHandler.default voidprintError(String message) Default method to print error messages to the user or API Client.default voidprintErrorMessage(OllamaMessage errorMessage) This is a default implementation when wrappingPrintAdvanceMessageHandlerto this "simpler"PrintMessageHandlerDefault method to print error messages to the user or API Client.voidprintMessage(String message) Handles the printing of a message.default voidprintMessage(OllamaMessage message) This is a default implementation when wrappingPrintAdvanceMessageHandlerto this "simpler"PrintMessageHandlerdefault voidprintToolCalling(String representation) Used when a tool is to have it's calling rendered
-
Method Details
-
printMessage
Handles the printing of a message. This is meant to output the message to the user or API Client.- Parameters:
message- The message to be printed.
-
printMessage
This is a default implementation when wrappingPrintAdvanceMessageHandlerto this "simpler"PrintMessageHandler- Specified by:
printMessagein interfacePrintAdvanceMessageHandler- Parameters:
message- TheOllamaMessagerequested to be printed from a veriity of sources, seeOllamaMessageRole
-
color
boolean color()Gets if color is supported by the PrintMessageHandler. This uses ANSI escape codes to color the output.- Returns:
- a boolean indicating if color is supported by the PrintMessageHandler.
-
printError
Default method to print error messages to the user or API Client. This uses ANSI escape codes to color the output red if color is supported.- Parameters:
message- The error message to be printed. If color is not supported, it will print the message without color.
-
printErrorMessage
This is a default implementation when wrappingPrintAdvanceMessageHandlerto this "simpler"PrintMessageHandlerDefault method to print error messages to the user or API Client. This uses ANSI escape codes to color the output red if color is supported.- Specified by:
printErrorMessagein interfacePrintAdvanceMessageHandler- Parameters:
errorMessage- The error message to be printed. If color is not supported, it will print the message without color.
-
printToolCalling
Description copied from interface:PrintAdvanceMessageHandlerUsed when a tool is to have it's calling rendered- Specified by:
printToolCallingin interfacePrintAdvanceMessageHandler- Parameters:
representation- the string to be printed
-