chatapi/src/main/java/eu/m724/responsesource/ChatResponse.java
Minecon724 6ce5453de0
make it better
so I somewhat figured it
2024-08-29 13:22:48 +02:00

32 lines
999 B
Java

package eu.m724.responsesource;
import eu.m724.chat.ChatEvent;
import eu.m724.chat.ChatMessage;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.LinkedBlockingQueue;
public interface ChatResponse {
/**
* is this response streaming
* if it's not, the queue will get one element that is the whole response
*
* @return is this response streaming
*/
boolean isStreaming();
/**
* if streamed, text token by token as it goes (or other splitting depending on the source)
* if not, the {@link CompletableFuture} returns just the whole response after it's ready
*
* @return the fifo queue with each element being a part. null ends the sequence
*/
LinkedBlockingQueue<ChatEvent> eventQueue();
/**
* gets the resulting {@link ChatMessage} when it's ready
*
* @return the resulting {@link ChatMessage} as soon as the response is complete
*/
CompletableFuture<ChatMessage> message();
}