Class OllamaChatModel.Builder
java.lang.Object
io.agentscope.extensions.model.ollama.OllamaChatModel.Builder
- Enclosing class:
- OllamaChatModel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()contextWindowSize(int contextWindowSize) defaultOptions(OllamaOptions defaultOptions) formatter(io.agentscope.core.formatter.Formatter<OllamaMessage, OllamaResponse, OllamaRequest> formatter) httpTransport(io.agentscope.core.model.transport.HttpTransport httpTransport) Sets the HTTP transport to use.proxy(io.agentscope.core.model.transport.ProxyConfig proxyConfig) Sets the proxy configuration for HTTP traffic.stream(boolean stream) Sets whether streaming should be enabled.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
modelName
-
baseUrl
-
stream
Sets whether streaming should be enabled.Default is
true -
defaultOptions
-
formatter
public OllamaChatModel.Builder formatter(io.agentscope.core.formatter.Formatter<OllamaMessage, OllamaResponse, OllamaRequest> formatter) -
httpTransport
public OllamaChatModel.Builder httpTransport(io.agentscope.core.model.transport.HttpTransport httpTransport) Sets the HTTP transport to use.Note on proxy configuration: Because
httpTransportis a fully-constructed HTTP client instance, its configuration (including proxy) cannot be modified after creation. If you need to configure a proxy, either:- Use
proxy(ProxyConfig)without callinghttpTransport(), for simple proxy-only customization. - Configure the proxy directly within the transport's
HttpTransportConfigwhen building the transport instance.
If both
httpTransport()andproxy()are called,httpTransport()takes full precedence andproxy()is ignored (a warning is logged at build time).- Parameters:
httpTransport- the HTTP transport (null for default from factory)- Returns:
- this builder instance
- Use
-
proxy
Sets the proxy configuration for HTTP traffic.Interaction with
httpTransport(HttpTransport): BecausehttpTransportis a fully-constructed HTTP client instance, its configuration cannot be modified after creation. The final transport is determined as follows:- If only
proxy()is called: the defaultOkHttpTransportis used with the specified proxy configuration applied. - If only
httpTransport()is called: the provided transport is used as-is (proxy must be configured within the transport's ownHttpTransportConfig). - If both are called:
httpTransport()takes full precedence. Theproxy()setting is ignored and a warning is logged. To configure proxy with a custom transport, set it within the transport'sHttpTransportConfigdirectly. - If neither is called: the default transport from
HttpTransportFactoryis used (no proxy).
- Parameters:
proxyConfig- the proxy configuration (seeProxyConfig)- Returns:
- this builder instance
- If only
-
contextWindowSize
-
build
-