Class NaruCustomProvider
java.lang.Object
net.thevpc.naru.api.model.AbstractNaruModelProvider
net.thevpc.naru.ext.models.openapi.AbstractOpenAICompatProvider
net.thevpc.naru.ext.models.custom.NaruCustomProvider
- All Implemented Interfaces:
NaruModelProvider,net.thevpc.nuts.spi.NComponent
Generic config-driven provider: lets users point NARU at any wire-compatible
endpoint (OpenAI-compatible, Anthropic Messages, ...) with zero code.
Configuration (per named endpoint):
custom.endpoints=<name1>,<name2>,... custom.endpoints.<name>.url=https://my-server custom.endpoints.<name>.type=openapi|anthropic (optional, default: openapi) custom.endpoints.<name>.apiKey=sk-... custom.endpoints.<name>.models=model-a,model-b custom.endpoints.<name>.chatPath=v1/chat/completions (optional) custom.endpoints.<name>.contextLength=32768 (optional) custom.endpoints.<name>.tools=true (optional) custom.endpoints.<name>.probe=true (optional, default: true)
Models are addressed as custom/<endpoint>/<model>.
By default each endpoint is probed (short-timeout GET on its url + TTL cache)
before its models show up in listings; set probe=false to opt out.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbaseUrl(NaruSession session) Fallback base url when<name>.urlconfig is not set.findModelIds(NaruSession session) net.thevpc.nuts.util.NOptional<NaruModelProtocol>getProtocol(NaruModelConfig model, NaruSession session) booleanisAvailable(NaruSession session) protected NaruModelCapabilitiesresolveCapabilities(String model, NaruSession session) Statically maps capabilities since cloud-hosted capabilities cannot be polled natively.Methods inherited from class net.thevpc.naru.ext.models.openapi.AbstractOpenAICompatProvider
chatPath, connectTimeout, createProtocol, fetchLiveModelIds, findModelIdsWithLiveFallback, isApiKeySet, isReachable, modelsPath, readTimeoutMethods inherited from class net.thevpc.naru.api.model.AbstractNaruModelProvider
apiKey, defaultEnvKey, getParam, getParamNames, getSecureParam, isEnabled, name, onParamChanged, setEnabled, setParamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.thevpc.naru.api.model.NaruModelProvider
installModel, isSupportedInstallModel, isSupportedPsModel, isSupportedUninstallModel, isSupportedUnloadModel, psModel, uninstallModel, unloadModel
-
Constructor Details
-
NaruCustomProvider
public NaruCustomProvider()
-
-
Method Details
-
getProtocol
public net.thevpc.nuts.util.NOptional<NaruModelProtocol> getProtocol(NaruModelConfig model, NaruSession session) - Specified by:
getProtocolin interfaceNaruModelProvider- Overrides:
getProtocolin classAbstractOpenAICompatProvider
-
isAvailable
-
findModelIds
- Specified by:
findModelIdsin interfaceNaruModelProvider- Overrides:
findModelIdsin classAbstractOpenAICompatProvider
-
baseUrl
Description copied from class:AbstractOpenAICompatProviderFallback base url when<name>.urlconfig is not set.- Specified by:
baseUrlin classAbstractOpenAICompatProvider
-
resolveCapabilities
Description copied from class:AbstractOpenAICompatProviderStatically maps capabilities since cloud-hosted capabilities cannot be polled natively.- Specified by:
resolveCapabilitiesin classAbstractOpenAICompatProvider
-