Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
OllamaToolsResult.java
Go to the documentation of this file.
1package io.github.ollama4j.tools;
2
3import io.github.ollama4j.models.response.OllamaResult;
4import lombok.AllArgsConstructor;
5import lombok.Data;
6import lombok.NoArgsConstructor;
7
8import java.util.ArrayList;
9import java.util.List;
10import java.util.Map;
11
12@Data
13@NoArgsConstructor
14@AllArgsConstructor
15public class OllamaToolsResult {
16 private OllamaResult modelResult;
17 private Map<ToolFunctionCallSpec, Object> toolResults;
18
19 public List<ToolResult> getToolResults() {
20 List<ToolResult> results = new ArrayList<>();
21 for (Map.Entry<ToolFunctionCallSpec, Object> r : this.toolResults.entrySet()) {
22 results.add(new ToolResult(r.getKey().getName(), r.getKey().getArguments(), r.getValue()));
23 }
24 return results;
25 }
26
27 @Data
28 @NoArgsConstructor
29 @AllArgsConstructor
30 public static class ToolResult {
31 private String functionName;
32 private Map<String, Object> functionArguments;
33 private Object result;
34 }
35}