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 StringgetBackendNameFromPrefixedModel(String model)GPTBackendConfigurationgetConfigurationForModel(String model)Determines the backend a model is from.StringgetModelNameInBackend(String model)If the model is of the formbackendId:modelnamethen 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:GPTBackendsServiceList of all model names configured for the active backends, no matter from which backend.- Specified by:
getAllModelsin interfaceGPTBackendsService
-
getActiveBackends
@Nonnull public List<String> getActiveBackends()
Description copied from interface:GPTBackendsServiceReturns a list of active backends. Those can be used as prefix for unconfigured modelsbackendId:modelname.- Specified by:
getActiveBackendsin interfaceGPTBackendsService
-
getModelNameInBackend
@Nullable public String getModelNameInBackend(@Nullable String model)
Description copied from interface:GPTBackendsServiceIf the model is of the formbackendId:modelnamethen this returns the modelname, otherwise returns the model as it is.- Specified by:
getModelNameInBackendin interfaceGPTBackendsService
-
getBackendNameFromPrefixedModel
@Nullable protected String getBackendNameFromPrefixedModel(@Nullable String model)
-
getConfigurationForModel
public GPTBackendConfiguration getConfigurationForModel(@Nonnull String model)
Description copied from interface:GPTBackendsServiceDetermines the backend a model is from.- Specified by:
getConfigurationForModelin 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.
-
-