Package com.unfbx.chatgpt
Class OpenAiStreamClient
- java.lang.Object
-
- com.unfbx.chatgpt.OpenAiStreamClient
-
public class OpenAiStreamClient extends Object
描述: open ai 客户端- Author:
- https:www.unfbx.com 2023-02-28
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOpenAiStreamClient.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description BillingUsagebillingUsage(@NotNull LocalDate starDate, @NotNull LocalDate endDate)账户调用接口消耗金额信息查询 最多查询100天static OpenAiStreamClient.Builderbuilder()构造CreditGrantsResponsecreditGrants()Deprecated.voidstreamChatCompletion(List<Message> messages, okhttp3.sse.EventSourceListener eventSourceListener)流式输出,最新版的GPT-3.5 chat completion 更加贴近官方网站的问答模型 警告:(不支持图片输入)<T extends BaseChatCompletion>
voidstreamChatCompletion(T chatCompletion, okhttp3.sse.EventSourceListener eventSourceListener)流式输出,最新版的GPT-3.5 chat completion 更加贴近官方网站的问答模型<R extends PluginParam,T>
voidstreamChatCompletionWithPlugin(ChatCompletion chatCompletion, okhttp3.sse.EventSourceListener eventSourceListener, PluginAbstract<R,T> plugin)插件问答简易版 默认取messages最后一个元素构建插件对话 默认模型:ChatCompletion.Model.GPT_3_5_TURBO_16K_0613<R extends PluginParam,T>
voidstreamChatCompletionWithPlugin(ChatCompletion chatCompletion, okhttp3.sse.EventSourceListener eventSourceListener, PluginListener pluginEventSourceListener, PluginAbstract<R,T> plugin)插件问答简易版 默认取messages最后一个元素构建插件对话 默认模型:ChatCompletion.Model.GPT_3_5_TURBO_16K_0613<R extends PluginParam,T>
voidstreamChatCompletionWithPlugin(List<Message> messages, String model, okhttp3.sse.EventSourceListener eventSourceListener, PluginAbstract<R,T> plugin)插件问答简易版 默认取messages最后一个元素构建插件对话<R extends PluginParam,T>
voidstreamChatCompletionWithPlugin(List<Message> messages, okhttp3.sse.EventSourceListener eventSourceListener, PluginAbstract<R,T> plugin)插件问答简易版 默认取messages最后一个元素构建插件对话 默认模型:ChatCompletion.Model.GPT_3_5_TURBO_16K_0613voidstreamCompletions(Completion completion, okhttp3.sse.EventSourceListener eventSourceListener)问答接口 stream 形式voidstreamCompletions(String question, okhttp3.sse.EventSourceListener eventSourceListener)问答接口-简易版Subscriptionsubscription()账户信息查询:里面包含总金额等信息
-
-
-
Method Detail
-
streamCompletions
public void streamCompletions(Completion completion, okhttp3.sse.EventSourceListener eventSourceListener)
问答接口 stream 形式- Parameters:
completion- open ai 参数eventSourceListener- sse监听器- See Also:
ConsoleEventSourceListener
-
streamCompletions
public void streamCompletions(String question, okhttp3.sse.EventSourceListener eventSourceListener)
问答接口-简易版- Parameters:
question- 请求参数eventSourceListener- sse监听器- See Also:
ConsoleEventSourceListener
-
streamChatCompletion
public <T extends BaseChatCompletion> void streamChatCompletion(T chatCompletion, okhttp3.sse.EventSourceListener eventSourceListener)
流式输出,最新版的GPT-3.5 chat completion 更加贴近官方网站的问答模型- Parameters:
chatCompletion- 问答参数eventSourceListener- sse监听器- See Also:
ConsoleEventSourceListener
-
streamChatCompletion
public void streamChatCompletion(List<Message> messages, okhttp3.sse.EventSourceListener eventSourceListener)
流式输出,最新版的GPT-3.5 chat completion 更加贴近官方网站的问答模型 警告:(不支持图片输入)- Parameters:
messages- 问答列表eventSourceListener- sse监听器- See Also:
ConsoleEventSourceListener
-
streamChatCompletionWithPlugin
public <R extends PluginParam,T> void streamChatCompletionWithPlugin(ChatCompletion chatCompletion, okhttp3.sse.EventSourceListener eventSourceListener, PluginListener pluginEventSourceListener, PluginAbstract<R,T> plugin)
插件问答简易版 默认取messages最后一个元素构建插件对话 默认模型:ChatCompletion.Model.GPT_3_5_TURBO_16K_0613- Type Parameters:
R- 插件自定义函数的请求值T- 插件自定义函数的返回值- Parameters:
chatCompletion- 参数eventSourceListener- sse监听器pluginEventSourceListener- 插件sse监听器,收集function call返回信息plugin- 插件
-
streamChatCompletionWithPlugin
public <R extends PluginParam,T> void streamChatCompletionWithPlugin(ChatCompletion chatCompletion, okhttp3.sse.EventSourceListener eventSourceListener, PluginAbstract<R,T> plugin)
插件问答简易版 默认取messages最后一个元素构建插件对话 默认模型:ChatCompletion.Model.GPT_3_5_TURBO_16K_0613- Type Parameters:
R- 插件自定义函数的请求值T- 插件自定义函数的返回值- Parameters:
chatCompletion- 参数eventSourceListener- sse监听器plugin- 插件
-
streamChatCompletionWithPlugin
public <R extends PluginParam,T> void streamChatCompletionWithPlugin(List<Message> messages, okhttp3.sse.EventSourceListener eventSourceListener, PluginAbstract<R,T> plugin)
插件问答简易版 默认取messages最后一个元素构建插件对话 默认模型:ChatCompletion.Model.GPT_3_5_TURBO_16K_0613- Type Parameters:
R- 插件自定义函数的请求值T- 插件自定义函数的返回值- Parameters:
messages- 问答参数eventSourceListener- sse监听器plugin- 插件
-
streamChatCompletionWithPlugin
public <R extends PluginParam,T> void streamChatCompletionWithPlugin(List<Message> messages, String model, okhttp3.sse.EventSourceListener eventSourceListener, PluginAbstract<R,T> plugin)
插件问答简易版 默认取messages最后一个元素构建插件对话- Type Parameters:
R- 插件自定义函数的请求值T- 插件自定义函数的返回值- Parameters:
messages- 问答参数model- 模型eventSourceListener- eventSourceListenerplugin- 插件
-
creditGrants
@Deprecated public CreditGrantsResponse creditGrants()
Deprecated.## 官方已经禁止使用此api OpenAi账户余额查询- Returns:
- 余额信息
-
subscription
public Subscription subscription()
账户信息查询:里面包含总金额等信息- Returns:
- 个人账户信息
-
billingUsage
public BillingUsage billingUsage(@NotNull @NotNull LocalDate starDate, @NotNull @NotNull LocalDate endDate)
账户调用接口消耗金额信息查询 最多查询100天- Parameters:
starDate- 开始时间endDate- 结束时间- Returns:
- 消耗金额信息
-
builder
public static OpenAiStreamClient.Builder builder()
构造- Returns:
- Builder
-
-