Class OllamaToolsHelper
java.lang.Object
io.agentscope.extensions.model.ollama.formatter.OllamaToolsHelper
Helper class for managing Ollama tool conversions and options application.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyOptions(OllamaRequest request, io.agentscope.core.model.GenerateOptions options, io.agentscope.core.model.GenerateOptions defaultOptions) Apply GenerateOptions to OllamaRequest.voidapplyOptions(OllamaRequest request, OllamaOptions options, OllamaOptions defaultOptions) Apply OllamaOptions to OllamaRequest.voidapplyToolChoice(OllamaRequest request, io.agentscope.core.model.ToolChoice toolChoice) Apply tool choice configuration to OllamaRequest.voidapplyTools(OllamaRequest request, List<io.agentscope.core.model.ToolSchema> tools) Apply tools to OllamaRequest.convertToolCalls(List<io.agentscope.core.message.ToolUseBlock> toolBlocks) Convert ToolUseBlock list to OllamaToolCall list.convertTools(List<io.agentscope.core.model.ToolSchema> tools) Converts a list of AgentScope ToolSchema objects to OllamaTool objects.
-
Constructor Details
-
OllamaToolsHelper
public OllamaToolsHelper()
-
-
Method Details
-
applyOptions
public void applyOptions(OllamaRequest request, io.agentscope.core.model.GenerateOptions options, io.agentscope.core.model.GenerateOptions defaultOptions) Apply GenerateOptions to OllamaRequest.- Parameters:
request- Ollama request to modifyoptions- Generation options to applydefaultOptions- Default options to use if options parameter is null
-
applyOptions
public void applyOptions(OllamaRequest request, OllamaOptions options, OllamaOptions defaultOptions) Apply OllamaOptions to OllamaRequest.- Parameters:
request- Ollama request to modifyoptions- Ollama options to applydefaultOptions- Default Ollama options to use if options parameter is null
-
convertTools
Converts a list of AgentScope ToolSchema objects to OllamaTool objects.- Parameters:
tools- The list of ToolSchema objects to convert.- Returns:
- A list of OllamaTool objects, or null if the input list is null or empty.
-
applyTools
Apply tools to OllamaRequest.- Parameters:
request- Ollama request to modifytools- List of tool schemas to apply (may be null or empty)
-
applyToolChoice
Apply tool choice configuration to OllamaRequest.- Parameters:
request- Ollama request to modifytoolChoice- The tool choice configuration (null means auto/default)
-
convertToolCalls
public List<OllamaToolCall> convertToolCalls(List<io.agentscope.core.message.ToolUseBlock> toolBlocks) Convert ToolUseBlock list to OllamaToolCall list.- Parameters:
toolBlocks- The tool use blocks to convert- Returns:
- List of OllamaToolCall objects (empty list if input is null/empty)
-