Package org.machanism.machai.ai.web
Class WebProvider
java.lang.Object
org.machanism.machai.ai.none.NoneProvider
org.machanism.machai.ai.web.WebProvider
- All Implemented Interfaces:
GenAIProvider
The
WebProvider class serves as a gateway for interacting with web-based
user interfaces via a web driver when direct access to the GenAI API is not feasible.
It automates communication with supported services such as
AI DIAL and
EPAM AI/Run CodeMie, utilizing recipes
from Anteater for sending and receiving information.
Limitations: Configuration and usage of this class may require additional plugins or handling of resources such as the clipboard, especially for platforms like CodeMie. Please refer to target platform instructions prior to use.
Usage Example
GenAIProvider provider = GenAIProviderManager.getProvider("Web:CodeMie");
Thread Safety
This implementation is not thread-safe.Parameters and Methods
- perform() - Executes the AE workspace task using input prompts.
- setWorkingDir(File workingDir) - Initializes workspace with configuration and runs setup nodes.
- model(String configName) - Sets the AE workspace configuration name.
- Since:
- 0.0.2
- Author:
- Viktor Tovstyi
-
Field Summary
Fields inherited from class org.machanism.machai.ai.none.NoneProvider
NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSets the AE workspace configuration name, validating change from previous value.perform()Executes the AE workspace task using provided input prompts.voidsetWorkingDir(File workingDir) Sets the working directory for AE workspace operations, initializes configuration and runs setup nodes if not already initialized.Methods inherited from class org.machanism.machai.ai.none.NoneProvider
addFile, addFile, addTool, clear, embedding, getPrompts, inputsLog, instructions, prompt, promptFile
-
Constructor Details
-
WebProvider
public WebProvider()
-
-
Method Details
-
perform
Executes the AE workspace task using provided input prompts.- Specified by:
performin interfaceGenAIProvider- Overrides:
performin classNoneProvider- Returns:
- the result string from AE task execution
- Throws:
IllegalArgumentException- if AE task execution fails (wraps any Exception)<code> String result = provider.perform(); </code>
-
setWorkingDir
Sets the working directory for AE workspace operations, initializes configuration and runs setup nodes if not already initialized.- Specified by:
setWorkingDirin interfaceGenAIProvider- Overrides:
setWorkingDirin classNoneProvider- Parameters:
workingDir- the working directory to be set- Throws:
IllegalArgumentException- if initialization fails
-
model
Sets the AE workspace configuration name, validating change from previous value.- Specified by:
modelin interfaceGenAIProvider- Overrides:
modelin classNoneProvider- Parameters:
configName- the name of the configuration file- Throws:
IllegalArgumentException- if configuration change is requested while already in use
-