Class NoneProvider

java.lang.Object
org.machanism.machai.ai.provider.none.NoneProvider
All Implemented Interfaces:
Genai

public class NoneProvider extends Object implements Genai
No-op implementation of 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

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 Details

  • Constructor Details

    • NoneProvider

      public NoneProvider()
  • Method Details

    • prompt

      public void prompt(String text)
      Appends the given text to the prompt buffer.

      Each call appends the provided text followed by a blank line.

      Specified by:
      prompt in interface Genai
      Parameters:
      text - prompt text to append
    • embedding

      public List<Double> embedding(String text, long dimensions)
      Indicates that embedding generation is not available for this provider.
      Specified by:
      embedding in interface Genai
      Parameters:
      text - input text
      dimensions - requested embedding size
      Returns:
      never returns normally
      Throws:
      UnsupportedOperationException - always thrown
    • clear

      public void clear()
      Clears the accumulated prompt buffer.
      Specified by:
      clear in interface Genai
    • addTool

      public void addTool(String name, String description, ToolFunction function, String... paramsDesc)
      Registers a tool.

      This provider does not support tools; the registration is ignored.

      Specified by:
      addTool in interface Genai
      Parameters:
      name - tool name
      description - tool description
      function - tool implementation
      paramsDesc - optional parameter descriptions
    • instructions

      public void instructions(String instructions)
      Sets instructions to be written during perform() (when inputsLog(File) is set).
      Specified by:
      instructions in interface Genai
      Parameters:
      instructions - instruction text
    • perform

      public String perform()
      Writes instructions (when set) and accumulated prompts to local files when inputsLog(File) is set.

      If the configured inputsLog has a parent folder, it is created when missing. If the configured inputsLog has no parent, the user directory is used as the target folder for writing instructions.txt.

      After writing, the internal prompt buffer is cleared.

      Specified by:
      perform in interface Genai
      Returns:
      null
    • inputsLog

      public void inputsLog(File inputsLog)
      Configures the file used for logging prompts.
      Specified by:
      inputsLog in interface Genai
      Parameters:
      inputsLog - log file to write during perform()
    • setWorkingDir

      public void setWorkingDir(File workingDir)
      Configures the working directory.

      This provider does not use a working directory; the configuration is ignored.

      Specified by:
      setWorkingDir in interface Genai
      Parameters:
      workingDir - ignored
    • usage

      public Usage usage()
      Returns token usage metrics captured from the most recent perform() call.

      Since this provider does not call a model, the returned usage is always zero.

      Specified by:
      usage in interface Genai
      Returns:
      usage metrics; never null
    • getPrompts

      public String getPrompts()
      Returns the accumulated prompt text.
      Returns:
      prompt text
    • init

      public void init(Configurator conf)
      Initializes this provider from configuration.

      This implementation performs no initialization and exists only for interface compatibility.

      Specified by:
      init in interface Genai
      Parameters:
      conf - configuration source (ignored)