Class GeminiProvider

java.lang.Object
org.machanism.machai.ai.provider.gemini.GeminiProvider
All Implemented Interfaces:
Genai

public class GeminiProvider extends Object implements Genai
MachAI Genai implementation for Google's Gemini models.

This provider adapts MachAI's provider-agnostic abstractions (prompts, tool definitions, files/attachments, and usage reporting) to Gemini's API.

Status

The current implementation is a placeholder. Most operations are not yet implemented and will be completed in a future iteration.

  • Constructor Details

    • GeminiProvider

      public GeminiProvider()
  • Method Details

    • init

      public void init(Configurator conf)
      Initializes this provider using the supplied configuration.
      Specified by:
      init in interface Genai
      Parameters:
      conf - provider configuration (for example, API keys, model selection, timeouts)
      Throws:
      org.apache.commons.lang.NotImplementedException - always thrown until the provider is fully implemented
    • prompt

      public void prompt(String text)
      Adds a plain-text prompt to the current request context.
      Specified by:
      prompt in interface Genai
      Parameters:
      text - prompt content to be sent to the model
    • embedding

      public List<Double> embedding(String text, long dimensions)
      Computes an embedding vector for the given text.
      Specified by:
      embedding in interface Genai
      Parameters:
      text - input text to embed
      dimensions - requested embedding dimensions
      Returns:
      embedding vector
      Throws:
      org.apache.commons.lang.NotImplementedException - always thrown until the provider is fully implemented
    • clear

      public void clear()
      Clears the current request context (prompt, files, tools, instructions).
      Specified by:
      clear in interface Genai
    • addTool

      public void addTool(String name, String description, ToolFunction function, String... paramsDesc)
      Registers a tool/function that the model may invoke.
      Specified by:
      addTool in interface Genai
      Parameters:
      name - tool name
      description - human-readable description of what the tool does
      function - function implementation to execute when invoked
      paramsDesc - parameter descriptors (provider/framework specific format)
    • instructions

      public void instructions(String instructions)
      Sets system-level instructions to guide model behavior for subsequent requests.
      Specified by:
      instructions in interface Genai
      Parameters:
      instructions - instruction text
    • perform

      public String perform()
      Executes the configured prompt against Gemini and returns the model output.
      Specified by:
      perform in interface Genai
      Returns:
      model response text
      Throws:
      org.apache.commons.lang.NotImplementedException - always thrown until the provider is fully implemented
    • inputsLog

      public void inputsLog(File bindexTempDir)
      Enables logging of provider inputs to the specified file.
      Specified by:
      inputsLog in interface Genai
      Parameters:
      bindexTempDir - directory used for writing log files
    • setWorkingDir

      public void setWorkingDir(File workingDir)
      Sets the working directory used for file resolution or other provider operations.
      Specified by:
      setWorkingDir in interface Genai
      Parameters:
      workingDir - working directory
    • usage

      public Usage usage()
      Returns usage information (for example, token counts) for the last request.
      Specified by:
      usage in interface Genai
      Returns:
      usage details, or null if not available
    • promptBundle

      public void promptBundle(ResourceBundle promptBundle)
      Adds prompts from the provided ResourceBundle to the current request context.

      This is typically used to load i18n/localized prompt templates.

      Parameters:
      promptBundle - resource bundle containing prompts/templates