Class ClaudeProvider
java.lang.Object
org.machanism.machai.ai.provider.claude.ClaudeProvider
- All Implemented Interfaces:
Genai
Anthropic-backed implementation of MachAI's
Genai
abstraction.
This provider adapts the Anthropic Java SDK to MachAI's provider interface.
- Since:
- 0.0.11
- Author:
- Viktor Tovstyi
-
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 custom tool function that the provider may invoke at runtime.voidclear()Clears any stored files and session/provider state.Computes an embedding vector for the provided text.voidinit(Configurator config) Initializes the provider with application configuration.voidEnables logging of provider inputs to the given directory.voidinstructions(String instructions) Sets system/session instructions for the current conversation.perform()Executes the provider to produce a response based on the accumulated prompts and state.voidAdds a user prompt to the current session.voidpromptBundle(ResourceBundle promptBundle) voidsetWorkingDir(File workingDir) Configures the working directory used for file and tool operations.usage()Returns token usage metrics for the most recentGenai.perform()invocation.
-
Constructor Details
-
ClaudeProvider
public ClaudeProvider()
-
-
Method Details
-
init
Description copied from interface:GenaiInitializes the provider with application configuration. -
prompt
Description copied from interface:GenaiAdds a user prompt to the current session. -
perform
Description copied from interface:GenaiExecutes the provider to produce a response based on the accumulated prompts and state. -
clear
public void clear()Description copied from interface:GenaiClears any stored files and session/provider state. -
addTool
Description copied from interface:GenaiRegisters a custom tool function that the provider may invoke at runtime.The expected argument structure passed to
functionis provider-specific.- Specified by:
addToolin interfaceGenai- Parameters:
name- tool name (unique per provider instance)description- human-readable description of the toolfunction- function implementation; receives an argument array and returns a resultparamsDesc- parameter descriptors (format is provider-specific)
-
instructions
Description copied from interface:GenaiSets system/session instructions for the current conversation.- Specified by:
instructionsin interfaceGenai- Parameters:
instructions- instruction text
-
promptBundle
-
inputsLog
Description copied from interface:GenaiEnables logging of provider inputs to the given directory. -
setWorkingDir
Description copied from interface:GenaiConfigures the working directory used for file and tool operations.- Specified by:
setWorkingDirin interfaceGenai- Parameters:
workingDir- the working directory
-
usage
Description copied from interface:GenaiReturns token usage metrics for the most recentGenai.perform()invocation. -
embedding
Description copied from interface:GenaiComputes an embedding vector for the provided text.
-