this looks good

This commit is contained in:
Minecon724 2024-08-31 12:25:36 +02:00
parent 307e2f7c1a
commit 7a38fd5762
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8
3 changed files with 4 additions and 27 deletions

View file

@ -58,7 +58,7 @@ class ExampleSource implements ChatSource {
return new ChatResponse() {
@Override
boolean isStreaming() {
boolean streaming() {
return false
}

View file

@ -13,7 +13,7 @@ public interface ChatResponse {
*
* @return is this response streaming
*/
boolean isStreaming();
boolean streaming();
/**
* if streamed, text token by token as it goes (or other splitting depending on the source)

View file

@ -6,29 +6,6 @@ import eu.m724.chat.ChatMessage;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.LinkedBlockingQueue;
public class SimpleChatResponse implements ChatResponse {
public final boolean streaming;
public final LinkedBlockingQueue<ChatEvent> eventQueue;
public final CompletableFuture<ChatMessage> message;
public SimpleChatResponse(boolean streaming, LinkedBlockingQueue<ChatEvent> eventQueue, CompletableFuture<ChatMessage> message) {
this.streaming = streaming;
this.eventQueue = eventQueue;
this.message = message;
}
@Override
public boolean isStreaming() {
return streaming;
}
@Override
public LinkedBlockingQueue<ChatEvent> eventQueue() {
return eventQueue;
}
@Override
public CompletableFuture<ChatMessage> message() {
return message;
}
public record SimpleChatResponse(boolean streaming, LinkedBlockingQueue<ChatEvent> eventQueue,
CompletableFuture<ChatMessage> message) implements ChatResponse {
}