Class GeminiProvider
java.lang.Object
org.machanism.machai.ai.provider.gemini.GeminiProvider
- All Implemented Interfaces:
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.
-
Field Summary
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/function that the model may invoke.voidclear()Clears the current request context (prompt, files, tools, instructions).Computes an embedding vector for the given text.voidinit(Configurator conf) Initializes this provider using the supplied configuration.voidEnables logging of provider inputs to the specified file.voidinstructions(String instructions) Sets system-level instructions to guide model behavior for subsequent requests.perform()Executes the configured prompt against Gemini and returns the model output.voidAdds a plain-text prompt to the current request context.voidpromptBundle(ResourceBundle promptBundle) Adds prompts from the providedResourceBundleto the current request context.voidsetWorkingDir(File workingDir) Sets the working directory used for file resolution or other provider operations.usage()Returns usage information (for example, token counts) for the last request.
-
Constructor Details
-
GeminiProvider
public GeminiProvider()
-
-
Method Details
-
init
Initializes this provider using the supplied configuration. -
prompt
Adds a plain-text prompt to the current request context. -
embedding
Computes an embedding vector for the given text. -
clear
public void clear()Clears the current request context (prompt, files, tools, instructions). -
addTool
Registers a tool/function that the model may invoke. -
instructions
Sets system-level instructions to guide model behavior for subsequent requests.- Specified by:
instructionsin interfaceGenai- Parameters:
instructions- instruction text
-
perform
Executes the configured prompt against Gemini and returns the model output. -
inputsLog
Enables logging of provider inputs to the specified file. -
setWorkingDir
Sets the working directory used for file resolution or other provider operations.- Specified by:
setWorkingDirin interfaceGenai- Parameters:
workingDir- working directory
-
usage
Returns usage information (for example, token counts) for the last request. -
promptBundle
Adds prompts from the providedResourceBundleto the current request context.This is typically used to load i18n/localized prompt templates.
- Parameters:
promptBundle- resource bundle containing prompts/templates
-