public interface ChatApi
| Modifier and Type | Method and Description |
|---|---|
io.reactivex.Single<ModelData> |
createChatCompletion(ChatCompletionCreateParams request)
Create a synchronous chat completion with immediate response Waits for the GLM-4
model to complete execution and returns the final result Supports complex
reasoning, tool calling, function execution, and multi-modal understanding Features
advanced capabilities like web search integration, code interpretation, and image
analysis
|
io.reactivex.Single<ModelData> |
createChatCompletionAsync(ChatCompletionCreateParams request)
Create an asynchronous chat completion for long-running tasks Submits the request
and returns immediately with a task ID for later result retrieval Ideal for complex
reasoning tasks, long document processing, or batch operations Supports advanced
GLM-4 models with extended context and computational requirements
|
retrofit2.Call<okhttp3.ResponseBody> |
createChatCompletionStream(ChatCompletionCreateParams request)
Create a streaming chat completion with real-time response Returns response content
incrementally through Server-Sent Events (SSE) for immediate user feedback
Optimized for interactive applications requiring low latency and progressive
content delivery Supports all GLM-4 models with configurable streaming parameters
and token-by-token generation
|
io.reactivex.Single<ModelData> |
queryAsyncResult(String id)
Query the result of an asynchronous chat completion task Retrieves the completion
result or current status using the task ID from async request Provides detailed
progress information for long-running tasks and complex reasoning operations
Supports polling-based result retrieval with comprehensive status reporting
|
@Streaming
@POST(value="chat/completions")
retrofit2.Call<okhttp3.ResponseBody> createChatCompletionStream(@Body
ChatCompletionCreateParams request)
request - Chat completion parameters including model selection (glm-4-plus,
glm-4-air, glm-4-flash), messages, temperature, top_p, max_tokens, and streaming
settings@POST(value="async/chat/completions") io.reactivex.Single<ModelData> createChatCompletionAsync(@Body ChatCompletionCreateParams request)
request - Chat completion parameters including model selection, messages,
advanced reasoning settings, tools configuration, and processing options@POST(value="chat/completions") io.reactivex.Single<ModelData> createChatCompletion(@Body ChatCompletionCreateParams request)
request - Chat completion parameters including model selection, conversation
messages, generation settings (temperature, top_p, max_tokens), tools
configuration, and response format@GET(value="async-result/{id}")
io.reactivex.Single<ModelData> queryAsyncResult(@Path(value="id")
String id)
id - Unique task ID returned from asynchronous chat completion requestCopyright © 2025. All rights reserved.