OpenAiSession.java 1.1 KB
Newer Older
小傅哥's avatar
小傅哥 已提交
1 2 3
package cn.bugstack.chatglm.session;

import cn.bugstack.chatglm.model.ChatCompletionRequest;
4
import cn.bugstack.chatglm.model.ChatCompletionResponse;
M
maxuan 已提交
5
import cn.bugstack.chatglm.model.ChatCompletionSyncResponse;
小傅哥's avatar
小傅哥 已提交
6 7 8 9
import com.fasterxml.jackson.core.JsonProcessingException;
import okhttp3.sse.EventSource;
import okhttp3.sse.EventSourceListener;

M
maxuan 已提交
10
import java.io.IOException;
11 12
import java.util.concurrent.CompletableFuture;

小傅哥's avatar
小傅哥 已提交
13 14 15 16 17 18 19 20 21 22
/**
 * @author 小傅哥,微信:fustack
 * @description 会话服务接口
 * @github https://github.com/fuzhengwei
 * @Copyright 公众号:bugstack虫洞栈 | 博客:https://bugstack.cn - 沉淀、分享、成长,让自己和他人都能有所收获!
 */
public interface OpenAiSession {

    EventSource completions(ChatCompletionRequest chatCompletionRequest, EventSourceListener eventSourceListener) throws JsonProcessingException;

23 24
    CompletableFuture<String> completions(ChatCompletionRequest chatCompletionRequest) throws InterruptedException;

M
maxuan 已提交
25 26
    ChatCompletionSyncResponse completionsSync(ChatCompletionRequest chatCompletionRequest) throws IOException;

小傅哥's avatar
小傅哥 已提交
27
}