Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
OllamaResultStream.java
Go to the documentation of this file.
1package io.github.ollama4j.models.response;
2
3import java.util.Iterator;
4import java.util.LinkedList;
5import java.util.Queue;
6
7public class OllamaResultStream extends LinkedList<String> implements Queue<String> {
8 @Override
9 public String poll() {
10 StringBuilder tokens = new StringBuilder();
11 Iterator<String> iterator = this.listIterator();
12 while (iterator.hasNext()) {
13 tokens.append(iterator.next());
14 iterator.remove();
15 }
16 return tokens.toString();
17 }
18}