2024-08-27 14:05:52 +02:00
|
|
|
package eu.m724.responsesource;
|
|
|
|
|
2024-08-28 15:09:38 +02:00
|
|
|
import eu.m724.chat.ChatMessage;
|
|
|
|
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
2024-08-27 14:05:52 +02:00
|
|
|
public interface ChatResponse {
|
2024-08-28 15:09:38 +02:00
|
|
|
/**
|
|
|
|
* is this response streaming
|
|
|
|
* @return is this response streaming
|
|
|
|
*/
|
2024-08-27 14:05:52 +02:00
|
|
|
boolean isStreaming();
|
2024-08-28 15:09:38 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 yeah
|
|
|
|
*/
|
|
|
|
CompletableFuture<String> text(); // TODO completablefuture is not correct here also fix the doc
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gets the resulting {@link ChatMessage}
|
|
|
|
* TODO I think it should be available after streaming is done so maybe wrap this in {@link CompletableFuture}
|
|
|
|
* @return the resulting {@link ChatMessage}
|
|
|
|
*/
|
|
|
|
ChatMessage message();
|
2024-08-27 14:05:52 +02:00
|
|
|
}
|