Class GPTBackendsServiceImpl
- java.lang.Object
-
- com.composum.ai.backend.base.service.chat.impl.GPTBackendsServiceImpl
-
- All Implemented Interfaces:
GPTBackendsService
public class GPTBackendsServiceImpl extends Object implements GPTBackendsService
-
-
Field Summary
Fields Modifier and Type Field Description protected List<GPTBackendsConfigurationService>
backendsConfigurationServices
-
Constructor Summary
Constructors Constructor Description GPTBackendsServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getActiveBackends()
Returns a list of active backends.List<String>
getAllModels()
List of all model names configured for the active backends, no matter from which backend.protected String
getBackendNameFromPrefixedModel(String model)
GPTBackendConfiguration
getConfigurationForModel(String model)
Determines the backend a model is from.String
getModelNameInBackend(String model)
If the model is of the formbackendId:modelname
then this returns the modelname, otherwise returns the model as it is.
-
-
-
Field Detail
-
backendsConfigurationServices
protected volatile List<GPTBackendsConfigurationService> backendsConfigurationServices
-
-
Method Detail
-
getAllModels
@Nonnull public List<String> getAllModels()
Description copied from interface:GPTBackendsService
List of all model names configured for the active backends, no matter from which backend.- Specified by:
getAllModels
in interfaceGPTBackendsService
-
getActiveBackends
@Nonnull public List<String> getActiveBackends()
Description copied from interface:GPTBackendsService
Returns a list of active backends. Those can be used as prefix for unconfigured modelsbackendId:modelname
.- Specified by:
getActiveBackends
in interfaceGPTBackendsService
-
getModelNameInBackend
@Nullable public String getModelNameInBackend(@Nullable String model)
Description copied from interface:GPTBackendsService
If the model is of the formbackendId:modelname
then this returns the modelname, otherwise returns the model as it is.- Specified by:
getModelNameInBackend
in interfaceGPTBackendsService
-
getBackendNameFromPrefixedModel
@Nullable protected String getBackendNameFromPrefixedModel(@Nullable String model)
-
getConfigurationForModel
public GPTBackendConfiguration getConfigurationForModel(@Nonnull String model)
Description copied from interface:GPTBackendsService
Determines the backend a model is from.- Specified by:
getConfigurationForModel
in interfaceGPTBackendsService
- Parameters:
model
- the model name , possibly in the formbackendId:modelname
- in that case it can be a model that is not configured explicitly in the backend.- Returns:
- the backend configuration for the model or null if no backend is found.
-
-