Package org.machanism.machai.ai.manager
Class GenAIProviderManager
java.lang.Object
org.machanism.machai.ai.manager.GenAIProviderManager
Manages the instantiation of GenAIProvider implementations based on model identifier strings.
This class supports dynamic loading of GenAIProvider classes using reflection and resolves providers based on the model name format (e.g. "OpenAI:gpt-3.5-turbo").
Usage example:
GenAIProvider provider = GenAIProviderManager.getProvider("OpenAI:gpt-3.5-turbo");
provider.prompt("Hello!");
- Author:
- Viktor Tovstyi
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GenAIProvidergetProvider(String chatModel) Creates and returns the appropriate GenAIProvider based on the provided model string.
-
Constructor Details
-
GenAIProviderManager
public GenAIProviderManager()
-
-
Method Details
-
getProvider
Creates and returns the appropriate GenAIProvider based on the provided model string.- Parameters:
chatModel- the model string, formatted as "Provider:Model" or just "Model"- Returns:
- the resolved GenAIProvider
- Throws:
IllegalArgumentException- if the provider cannot be resolved or instantiated
-