chatapi/src/main/java/eu/m724/responsesource/ChatResponse.java

28 lines
850 B
Java
Raw Normal View History

package eu.m724.responsesource;
2024-08-28 15:09:38 +02:00
import eu.m724.chat.ChatMessage;
import java.util.concurrent.CompletableFuture;
public interface ChatResponse {
2024-08-28 15:09:38 +02:00
/**
* is this response streaming
* @return is this response streaming
*/
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();
}