32 lines
999 B
Java
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();
|
|
}
|