类 ModelCreationContext
java.lang.Object
io.agentscope.core.model.ModelCreationContext
Provider-neutral model creation context used by
ModelRegistry and model provider SPI
implementations.
This type has two layers:
- Standard fields such as
apiKey,baseUrl,endpointPath,stream, andenableThinking. These are common enough to be understood by multiple providers and can safely participate in automatic cache identity whenCachePolicy.ENABLEDis selected. - Provider-specific options and typed components. These allow extension modules to consume advanced builder settings such as formatters, HTTP transports, credentials, proxies, and default generation options without adding provider types to core.
Options and components are intentionally opaque to core. ModelRegistry never deep
hashes them or uses their hashCode() values for cache identity. When they are present and
caching is enabled, callers must provide an explicit ModelCreationContext.Builder.cacheId(String).
-
嵌套类概要
嵌套类 -
方法概要
修饰符和类型方法说明static ModelCreationContext.Builderbuilder()<T> TReturns a provider-specific component by type, ornull.static ModelCreationContextempty()API key or token to pass to a provider.Provider base URL override, for self-hosted or compatible API endpoints.Explicit cache identity used whengetCachePolicy()isCachePolicy.ENABLED.Cache policy forModelRegistry.resolve(String, ModelCreationContext).Provider-specific component objects keyed by type.Whether provider thinking/reasoning mode should be enabled.Provider endpoint path override, mainly for OpenAI-compatible APIs.Provider-specific scalar or value options keyed by extension-defined names.Whether the created model should use streaming by default.booleanReturns whether the context contains values that core cannot fingerprint safely.booleanisEmpty()Returns whether this context has no effective settings.Returns a provider-specific option value, ornull.<T> TReturns a provider-specific option cast to the requested type, ornull.Returns a mutable builder initialized from this context.toString()
-
方法详细资料
-
empty
-
builder
-
toBuilder
Returns a mutable builder initialized from this context.This is useful when a caller wants to derive a tenant- or request-specific context from a shared baseline without mutating the original instance.
-
getApiKey
API key or token to pass to a provider. Providers may fall back to environment variables. -
getBaseUrl
Provider base URL override, for self-hosted or compatible API endpoints. -
getEndpointPath
Provider endpoint path override, mainly for OpenAI-compatible APIs. -
getStream
Whether the created model should use streaming by default.nullmeans provider default. -
getEnableThinking
Whether provider thinking/reasoning mode should be enabled. -
getCachePolicy
Cache policy forModelRegistry.resolve(String, ModelCreationContext). -
getCacheId
Explicit cache identity used whengetCachePolicy()isCachePolicy.ENABLED. -
getOptions
Provider-specific scalar or value options keyed by extension-defined names. -
option
Returns a provider-specific option value, ornull. -
option
Returns a provider-specific option cast to the requested type, ornull. -
getComponents
Provider-specific component objects keyed by type. -
component
Returns a provider-specific component by type, ornull. -
isEmpty
public boolean isEmpty()Returns whether this context has no effective settings.The empty context preserves legacy
ModelRegistry.resolve(String)caching behavior. -
hasOpaqueCacheInputs
public boolean hasOpaqueCacheInputs()Returns whether the context contains values that core cannot fingerprint safely. -
toString
-