Class NoneProvider
- All Implemented Interfaces:
Genai
Genai.
This provider is intended for environments where no external LLM integration should be used.
It accumulates prompt text in memory and can optionally write instructions and prompts to local
files when inputsLog(File) has been configured.
Key characteristics
- No network calls are performed.
perform()always returnsnull.- Unsupported capabilities (for example,
embedding(String, long)) throwUnsupportedOperationException.
Example
Genai provider = new NoneProvider();
provider.inputsLog(new File("./inputsLog/inputs.txt"));
provider.instructions("You are a helpful assistant.");
provider.prompt("Describe the weather.");
provider.perform();
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringProvider name used for identification in configuration.Fields inherited from interface org.machanism.machai.ai.provider.Genai
LINE_SEPARATOR, LOG_INPUTS_PROP_NAME, PARAGRAPH_SEPARATOR, PASSWORD_PROP_NAME, SERVERID_PROP_NAME, USERNAME_PROP_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTool(String name, String description, ToolFunction function, String... paramsDesc) Registers a tool.voidclear()Clears the accumulated prompt buffer.Indicates that embedding generation is not available for this provider.Returns the accumulated prompt text.voidinit(Configurator conf) Initializes this provider from configuration.voidConfigures the file used for logging prompts.voidinstructions(String instructions) Sets instructions to be written duringperform()(wheninputsLog(File)is set).perform()Writes instructions (when set) and accumulated prompts to local files wheninputsLog(File)is set.voidAppends the given text to the prompt buffer.voidsetWorkingDir(File workingDir) Configures the working directory.usage()Returns token usage metrics captured from the most recentperform()call.
-
Field Details
-
NAME
Provider name used for identification in configuration.- See Also:
-
-
Constructor Details
-
NoneProvider
public NoneProvider()
-
-
Method Details
-
prompt
Appends the given text to the prompt buffer.Each call appends the provided text followed by a blank line.
-
embedding
Indicates that embedding generation is not available for this provider.- Specified by:
embeddingin interfaceGenai- Parameters:
text- input textdimensions- requested embedding size- Returns:
- never returns normally
- Throws:
UnsupportedOperationException- always thrown
-
clear
public void clear()Clears the accumulated prompt buffer. -
addTool
Registers a tool.This provider does not support tools; the registration is ignored.
-
instructions
Sets instructions to be written duringperform()(wheninputsLog(File)is set).- Specified by:
instructionsin interfaceGenai- Parameters:
instructions- instruction text
-
perform
Writes instructions (when set) and accumulated prompts to local files wheninputsLog(File)is set.If the configured
inputsLoghas a parent folder, it is created when missing. If the configuredinputsLoghas no parent, the user directory is used as the target folder for writinginstructions.txt.After writing, the internal prompt buffer is cleared.
-
inputsLog
Configures the file used for logging prompts. -
setWorkingDir
Configures the working directory.This provider does not use a working directory; the configuration is ignored.
- Specified by:
setWorkingDirin interfaceGenai- Parameters:
workingDir- ignored
-
usage
Returns token usage metrics captured from the most recentperform()call.Since this provider does not call a model, the returned usage is always zero.
-
getPrompts
Returns the accumulated prompt text.- Returns:
- prompt text
-
init
Initializes this provider from configuration.This implementation performs no initialization and exists only for interface compatibility.
-