程序包 cn.tbox.sdk
类 TboxClient
java.lang.Object
cn.tbox.sdk.TboxClient
Tbox client for making API requests.
-
构造器概要
构造器构造器说明TboxClient(HttpClientConfig httpClientConfig) Creates a new Tbox client.TboxClient(String authorization) Creates a new Tbox client with authorization. -
方法概要
修饰符和类型方法说明Makes a chat request to the Tbox API with default parameters.chat(String appId, String query, String userId, String conversationId, String requestId, Map<String, Object> inputs, boolean withMeta, MessageParser messageParser, Map<String, Object> clientProperties) Makes a chat request to the Tbox API.Makes a synchronous chat request to the Tbox API with default parameters.chatSync(String appId, String query, String userId, String conversationId, String requestId, Map<String, Object> inputs, Map<String, Object> clientProperties) Makes a synchronous chat request to the Tbox API.Makes a completion request to the Tbox API with default parameters.completion(String appId, Map<String, Object> inputs, String userId, String conversationId, String requestId, boolean withMeta, MessageParser messageParser, Map<String, Object> clientProperties) Makes a completion request to the Tbox API.Makes a synchronous completion request to the Tbox API with default parameters.completionSync(String appId, Map<String, Object> inputs, String userId, String conversationId, String requestId, Map<String, Object> clientProperties) Makes a synchronous completion request to the Tbox API.protected HttpClientcreateHttpClient(HttpClientConfig config) Creates the HTTP client instance.
-
构造器详细资料
-
TboxClient
Creates a new Tbox client.- 参数:
httpClientConfig- HTTP client configuration- 抛出:
TboxClientConfigException- if there's a configuration error
-
TboxClient
Creates a new Tbox client with authorization.- 参数:
authorization- Authorization token- 抛出:
TboxClientConfigException- if there's a configuration error
-
-
方法详细资料
-
createHttpClient
Creates the HTTP client instance. This method is protected to allow mocking in tests.- 参数:
config- HTTP client configuration- 返回:
- HTTP client instance
- 抛出:
TboxClientConfigException- if there's a configuration error
-
chat
public Iterable<Map<String,Object>> chat(String appId, String query, String userId, String conversationId, String requestId, Map<String, Object> inputs, boolean withMeta, MessageParser messageParser, Map<String, throws TboxClientConfigExceptionObject> clientProperties) Makes a chat request to the Tbox API. Used to call Tbox chat-type applications. Returns a unified streaming response format.- 参数:
appId- Application IDquery- Query textuserId- User IDconversationId- Conversation ID (optional)requestId- Request ID (optional)inputs- Input parameters (optional)withMeta- Whether to include meta information (optional)messageParser- Message parser (optional)clientProperties- Client properties (optional)- 返回:
- Iterable of parsed responses
- 抛出:
TboxClientConfigException- if there's a configuration error
-
chat
public Iterable<Map<String,Object>> chat(String appId, String query, String userId) throws TboxClientConfigException Makes a chat request to the Tbox API with default parameters.- 参数:
appId- Application IDquery- Query textuserId- User ID- 返回:
- Iterable of parsed responses
- 抛出:
TboxClientConfigException- if there's a configuration error
-
chatSync
public Map<String,Map<String, chatSyncObject>> (String appId, String query, String userId, String conversationId, String requestId, Map<String, Object> inputs, Map<String, throws TboxClientConfigExceptionObject> clientProperties) Makes a synchronous chat request to the Tbox API. Wraps the chat API into a synchronous interface.- 参数:
appId- Application IDquery- Query textuserId- User IDconversationId- Conversation ID (optional)requestId- Request ID (optional)inputs- Input parameters (optional)clientProperties- Client properties (optional)- 返回:
- Map of response data
- 抛出:
TboxClientConfigException- if there's a configuration error
-
chatSync
public Map<String,Map<String, chatSyncObject>> (String appId, String query, String userId) throws TboxClientConfigException Makes a synchronous chat request to the Tbox API with default parameters.- 参数:
appId- Application IDquery- Query textuserId- User ID- 返回:
- Map of response data
- 抛出:
TboxClientConfigException- if there's a configuration error
-
completion
public Iterable<Map<String,Object>> completion(String appId, Map<String, Object> inputs, String userId, String conversationId, String requestId, boolean withMeta, MessageParser messageParser, Map<String, throws TboxClientConfigExceptionObject> clientProperties) Makes a completion request to the Tbox API.- 参数:
appId- Application IDuserId- User IDinputs- Input parameters (optional)conversationId- Conversation ID (optional)requestId- Request ID (optional)withMeta- Whether to include meta information (optional)messageParser- Message parser (optional)clientProperties- Client properties (optional)- 返回:
- Iterable of parsed responses
- 抛出:
TboxClientConfigException- if there's a configuration error
-
completion
public Iterable<Map<String,Object>> completion(String appId, Map<String, Object> inputs, String userId) throws TboxClientConfigExceptionMakes a completion request to the Tbox API with default parameters.- 参数:
appId- Application IDinputs- Input parametersuserId- User ID- 返回:
- Iterable of parsed responses
- 抛出:
TboxClientConfigException- if there's a configuration error
-
completionSync
public Map<String,Map<String, completionSyncObject>> (String appId, Map<String, Object> inputs, String userId, String conversationId, String requestId, Map<String, throws TboxClientConfigExceptionObject> clientProperties) Makes a synchronous completion request to the Tbox API. Wraps the completion API into a synchronous interface.- 参数:
appId- Application IDinputs- Input parametersuserId- User IDconversationId- Conversation ID (optional)requestId- Request ID (optional)clientProperties- Client properties (optional)- 返回:
- Map of response data
- 抛出:
TboxClientConfigException- if there's a configuration error
-
completionSync
public Map<String,Map<String, completionSyncObject>> (String appId, Map<String, Object> inputs, String userId) throws TboxClientConfigExceptionMakes a synchronous completion request to the Tbox API with default parameters.- 参数:
appId- Application IDinputs- Input parametersuserId- User ID- 返回:
- Map of response data
- 抛出:
TboxClientConfigException- if there's a configuration error
-