chore: add code comment, remove unused (#5)

* refactor: remove unused code

* refactor: update

* refactor: update
This commit is contained in:
tomsun28 2025-07-14 15:13:30 +08:00 committed by GitHub
parent 71ae71b778
commit 65f2573772
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 509 additions and 145 deletions

View file

@ -10,15 +10,49 @@ import retrofit2.http.Body;
import retrofit2.http.POST;
import retrofit2.http.Streaming;
/**
* Agents API for intelligent agent capabilities based on GLM-4 All Tools Provides AI
* agents with automatic tool calling, function execution, and complex task automation
* Features include web browsing, code interpreter, image generation, and multi-tool
* coordination Supports streaming and synchronous agent interactions with real-time task
* planning
*/
public interface AgentsApi {
/**
* Create a streaming agent completion with GLM-4 All Tools Returns agent responses in
* real-time through Server-Sent Events (SSE) Automatically selects and calls
* appropriate tools (web search, code execution, image generation)
* @param request Agent completion parameters including tools, functions, and
* execution context
* @return Streaming response body with incremental agent outputs and tool execution
* results
*/
@Streaming
@POST("v1/agents")
Call<ResponseBody> agentsCompletionStream(@Body AgentsCompletionRequest request);
/**
* Create a synchronous agent completion with GLM-4 All Tools Waits for the agent to
* complete complex task execution and returns the final result Supports automatic
* tool selection including CogView3 image generation, Python code interpreter, and
* web browsing
* @param request Agent completion parameters including tools, functions, and
* execution context
* @return Complete agent execution response with results and comprehensive tool
* outputs
*/
@POST("v1/agents")
Single<ModelData> agentsCompletionSync(@Body AgentsCompletionRequest request);
/**
* Query the result of an asynchronous agent execution Retrieves the agent execution
* result using the task parameters for long-running tasks Useful for complex
* multi-tool operations that require extended processing time
* @param request Parameters for retrieving asynchronous agent execution results
* @return Agent execution result with tool outputs, status information, and task
* completion details
*/
@POST("v1/agents/async-result")
Single<ModelData> queryAgentsAsyncResult(@Body AgentAsyncResultRetrieveParams request);

View file

@ -13,18 +13,47 @@ import retrofit2.http.Body;
import retrofit2.http.POST;
import retrofit2.http.Streaming;
/**
* Assistant API for intelligent conversational AI Provides advanced assistant
* capabilities with streaming and synchronous responses Supports conversation management
* and usage tracking for AI assistants
*/
public interface AssistantApi {
/**
* Generate assistant response with streaming output Creates real-time conversational
* responses with streaming delivery
* @param request Assistant parameters including messages, model settings, and context
* @return Streaming response body with assistant's reply
*/
@Streaming
@POST("assistant")
Call<ResponseBody> assistantCompletionStream(@Body AssistantParameters request);
/**
* Generate assistant response with complete output Creates conversational responses
* and returns the complete assistant reply
* @param request Assistant parameters including conversation context and settings
* @return Complete assistant response with message content and metadata
*/
@POST("assistant")
Single<AssistantCompletion> assistantCompletion(@Body AssistantParameters request);
/**
* Query assistant support capabilities Retrieves information about available
* assistant features and supported operations
* @param request Query parameters for support information
* @return Assistant support status and available capabilities
*/
@POST("assistant/list")
Single<AssistantSupportStatus> querySupport(@Body QuerySupportParams request);
/**
* Query conversation usage statistics Retrieves usage metrics and conversation
* history for assistant interactions
* @param request Conversation query parameters including filters and pagination
* @return Conversation usage statistics and history information
*/
@POST("assistant/conversation/list")
Single<ConversationUsageListStatus> queryConversationUsage(@Body ConversationParameters request);

View file

@ -17,32 +17,74 @@ import retrofit2.http.Streaming;
import java.util.Map;
/**
* Audio API for advanced speech processing capabilities Powered by GLM-4-Voice for
* end-to-end speech understanding and generation Provides text-to-speech, speech-to-text,
* voice customization, and real-time conversation Supports emotion control, tone
* adjustment, speed variation, and dialect generation Features real-time audio
* processing, voice cloning, and multilingual ASR capabilities
*/
public interface AudioApi {
/**
* TTS interface (Text to speech)
* @param request
* @return
* Text-to-Speech (TTS) conversion using GLM-4-Voice Converts text input into
* natural-sounding speech audio with emotion and tone control Supports multiple
* voices, languages, speed adjustment, and various audio formats Features advanced
* voice synthesis with customizable emotional expressions and dialects
* @param request TTS parameters including text, voice selection, emotion, speed,
* tone, and output format
* @return Generated high-quality audio content in specified format with natural
* prosody
*/
@POST("audio/speech")
Single<ResponseBody> audioSpeech(@Body AudioSpeechRequest request);
/**
* Voice cloning interface
* @param request
* @return
* Voice cloning and customization using advanced neural models Creates custom voice
* models from provided audio samples with high fidelity Enables personalized speech
* synthesis preserving unique voice characteristics and speaking style Supports
* fine-tuning of voice parameters including pitch, timbre, and speaking patterns
* @param request Voice customization parameters including model settings and training
* options
* @param voiceData High-quality audio file containing voice samples for cloning
* (recommended: clear, diverse samples)
* @return Voice model creation result with customization status and model performance
* metrics
*/
@Multipart
@POST("audio/customization")
Single<ResponseBody> audioCustomization(@PartMap Map<String, RequestBody> request,
@Part MultipartBody.Part voiceData);
/**
* Streaming speech-to-text transcription using GLM ASR Converts audio files to text
* with real-time streaming results and low latency Returns transcription results
* incrementally as they become available for immediate processing Optimized for
* real-time applications requiring immediate text feedback
* @param request Transcription parameters including language detection, model
* selection, and streaming settings
* @param file Audio file to be transcribed (supports various formats: wav, mp3, m4a,
* etc.)
* @return Streaming transcription results with timestamps and confidence scores
*/
@Streaming
@POST("audio/transcriptions")
@Multipart
Call<ResponseBody> audioTranscriptionsStream(@PartMap Map<String, RequestBody> request,
@Part MultipartBody.Part file);
/**
* Speech-to-text transcription using GLM ASR models Converts audio files to text with
* high accuracy and multilingual support Features advanced noise reduction, speaker
* recognition, and punctuation restoration Supports multiple languages with automatic
* language detection capabilities
* @param request Transcription parameters including language preference, model
* selection, and output format options
* @param file Audio file to be transcribed (supports wav, mp3, m4a, flac, and other
* common formats)
* @return Complete transcription result with text, timestamps, confidence scores, and
* speaker information
*/
@POST("audio/transcriptions")
@Multipart
Single<ModelData> audioTranscriptions(@PartMap Map<String, RequestBody> request, @Part MultipartBody.Part file);

View file

@ -10,17 +10,55 @@ import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
/**
* Batch Processing API for large-scale data operations Enables efficient processing of
* millions of requests with cost-effective batch execution Provides up to 50% discount
* compared to individual API calls with 24-hour completion guarantee Supports up to
* 50,000 requests per batch with maximum 200MB input file size Ideal for evaluation,
* classification, and embedding tasks that don't require immediate responses
*/
public interface BatchesApi {
/**
* Create a new batch processing job Submits a large number of requests for efficient
* batch processing with JSONL format Each request must include a unique custom_id for
* result mapping Supports /v1/chat/completions and /v1/embeddings endpoints
* @param batchCreateParams Batch configuration including input file, endpoint, and
* processing options
* @return Batch job information with ID, status, and processing details
*/
@POST("batches")
Single<Batch> batchesCreate(@Body BatchCreateParams batchCreateParams);
/**
* Retrieve details of a specific batch job Gets comprehensive information about batch
* processing status and results Status can be: validating, failed, in_progress,
* finalizing, completed, expired, cancelling, cancelled
* @param batchId Unique identifier of the batch job to retrieve
* @return Batch job details including progress, completion status, output_file_id,
* and error_file_id
*/
@GET("batches/{batch_id}")
Single<Batch> batchesRetrieve(@Path("batch_id") String batchId);
/**
* List all batch jobs with pagination Retrieves a paginated list of all batch
* processing jobs with filtering options Useful for monitoring multiple batch
* operations and their completion status
* @param after Cursor for pagination to get batches after this point
* @param limit Maximum number of batch jobs to return per page (default: 20)
* @return Paginated list of batch jobs with status, request counts, and metadata
*/
@GET("batches")
Single<BatchPage> batchesList(@Query("after") String after, @Query("limit") Integer limit);
/**
* Cancel a running batch job Stops the batch processing and marks the job as
* cancelled (may take up to 10 minutes) Only works for batches in 'validating' or
* 'in_progress' status
* @param batchId Unique identifier of the batch job to cancel
* @return Updated batch job status after cancellation with final request counts
*/
@POST("batches/{batch_id}/cancel")
Single<Batch> batchesCancel(@Path("batch_id") String batchId);

View file

@ -11,18 +11,68 @@ import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Streaming;
/**
* Chat Completions API for advanced GLM-4 series models Provides synchronous,
* asynchronous, and streaming chat completion capabilities Supports complex reasoning,
* long context processing (up to 128K tokens), and ultra-fast inference Features
* GLM-4-Plus, GLM-4-Air, GLM-4-Flash, and GLM-4-AllTools with specialized capabilities
* Optimized for Chinese and multilingual conversations with superior performance
*/
public interface ChatApi {
/**
* 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
* @param 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
* @return Streaming response body with incremental content, usage statistics, and
* completion indicators
*/
@Streaming
@POST("chat/completions")
Call<ResponseBody> createChatCompletionStream(@Body 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
* @param request Chat completion parameters including model selection, messages,
* advanced reasoning settings, tools configuration, and processing options
* @return Task information with unique ID, estimated completion time, and processing
* status for asynchronous tracking
*/
@POST("async/chat/completions")
Single<ModelData> createChatCompletionAsync(@Body 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
* @param request Chat completion parameters including model selection, conversation
* messages, generation settings (temperature, top_p, max_tokens), tools
* configuration, and response format
* @return Complete chat completion response with generated content, usage statistics,
* tool call results, and reasoning traces
*/
@POST("chat/completions")
Single<ModelData> createChatCompletion(@Body ChatCompletionCreateParams request);
/**
* 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
* @param id Unique task ID returned from asynchronous chat completion request
* @return Chat completion result with generated content, processing status,
* completion percentage, and any intermediate results or error information
*/
@GET("async-result/{id}")
Single<ModelData> queryAsyncResult(@Path("id") String id);

View file

@ -6,8 +6,25 @@ import io.reactivex.Single;
import retrofit2.http.Body;
import retrofit2.http.POST;
/**
* Embeddings API for text vectorization using GLM models Converts text into
* high-dimensional vector representations for semantic similarity and search Supports
* batch processing of multiple text inputs with configurable dimensions Ideal for RAG
* applications, semantic search, text classification, and similarity matching Features
* optimized performance for Chinese and multilingual text processing
*/
public interface EmbeddingApi {
/**
* Create embeddings for input text using GLM embedding models Converts text strings
* into numerical vector representations that capture semantic meaning Supports
* customizable vector dimensions for different use cases and performance requirements
* Optimized for both single text and batch processing scenarios
* @param request Embedding parameters including input text, model selection,
* dimensions, and encoding format
* @return High-quality embedding vectors with usage statistics and token consumption
* details
*/
@POST("embeddings")
Single<EmbeddingResult> createEmbeddings(@Body EmbeddingCreateParams request);

View file

@ -15,21 +15,58 @@ import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.Streaming;
/**
* File Management API for document and data handling Provides file upload, retrieval,
* deletion, and content access capabilities Supports various file formats for
* fine-tuning, knowledge base, and other AI tasks
*/
public interface FileApi {
/**
* Upload a file to the platform Stores files for use in fine-tuning, knowledge base,
* or other AI operations
* @param multipartBody File data with metadata including purpose and format
* @return File information including ID, name, size, and upload status
*/
@POST("files")
Single<File> uploadFile(@Body MultipartBody multipartBody);
/**
* Retrieve file metadata and information Gets detailed information about a previously
* uploaded file
* @param fileId Unique identifier of the file to retrieve
* @return File metadata including name, size, purpose, and creation time
*/
@GET("files/{file_id}")
Single<File> retrieveFile(@Path("file_id") String fileId);
/**
* Delete a file from the platform Permanently removes the file and all associated
* data
* @param fileId Unique identifier of the file to delete
* @return Confirmation of file deletion with status information
*/
@DELETE("files/{file_id}")
Single<FileDeleted> deletedFile(@Path("file_id") String fileId);
/**
* Query and list files with filtering options Retrieves a paginated list of files
* with optional filtering by purpose and ordering
* @param after Cursor for pagination to get files after this point
* @param purpose Filter files by their intended purpose (e.g., fine-tune, assistants)
* @param order Sort order for the file list (e.g., created_at)
* @param limit Maximum number of files to return per page
* @return Paginated list of files with metadata
*/
@GET("files")
Single<QueryFileResult> queryFileList(@Query("after") String after, @Query("purpose") String purpose,
@Query("order") String order, @Query("limit") Integer limit);
/**
* Download file content Streams the actual file content for download or processing
* @param fileId Unique identifier of the file to download
* @return Streaming file content in original format
*/
@Streaming
@GET("files/{file_id}/content")
Call<ResponseBody> fileContent(@Path("file_id") String fileId);

View file

@ -13,29 +13,98 @@ import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
/**
* Fine-tuning API for advanced model customization Enables training custom models based
* on GLM-4, CodeGeeX-4, and other foundation models Supports domain-specific fine-tuning
* for chat, code generation, embedding, and specialized tasks Features LoRA (Low-Rank
* Adaptation) and full parameter fine-tuning with efficient data processing Optimized for
* Chinese and multilingual scenarios with robust training pipeline
*/
public interface FineTuningApi {
/**
* Create a new fine-tuning job for model customization Initiates the training process
* for customizing GLM-4, CodeGeeX-4, or other base models Supports various
* fine-tuning strategies including LoRA, full parameter tuning, and adapter methods
* Enables domain adaptation for specific use cases like coding, conversation, or
* specialized knowledge
* @param request Fine-tuning job parameters including base model selection, training
* dataset, hyperparameters, and optimization settings
* @return Fine-tuning job information with unique job ID, status, and initial
* training configuration details
*/
@POST("fine_tuning/jobs")
Single<FineTuningJob> createFineTuningJob(@Body FineTuningJobRequest request);
/**
* List events for a specific fine-tuning job with detailed monitoring Retrieves
* comprehensive training progress including loss metrics, validation scores, and
* status updates Provides real-time monitoring of training convergence, learning rate
* schedules, and performance indicators Essential for tracking model quality and
* identifying potential training issues
* @param fineTuningJobId Unique identifier of the fine-tuning job
* @param limit Maximum number of events to return (recommended: 50-100 for efficient
* monitoring)
* @param after Cursor for pagination to get events after this timestamp
* @return List of fine-tuning events with timestamps, training metrics, validation
* results, and status details
*/
@GET("fine_tuning/jobs/{fine_tuning_job_id}/events")
Single<FineTuningEvent> listFineTuningJobEvents(@Path("fine_tuning_job_id") String fineTuningJobId,
@Query("limit") Integer limit, @Query("after") String after);
/**
* Retrieve comprehensive details of a specific fine-tuning job Gets complete
* information about job status, training progress, model performance, and
* configuration Includes training metrics, validation results, estimated completion
* time, and resource usage Provides insights into model convergence and fine-tuning
* effectiveness
* @param fineTuningJobId Unique identifier of the fine-tuning job
* @param limit Maximum number of items to return in nested collections (events,
* checkpoints)
* @param after Cursor for pagination in nested collections
* @return Complete fine-tuning job details including status, metrics, configuration,
* and performance indicators
*/
@GET("fine_tuning/jobs/{fine_tuning_job_id}")
Single<FineTuningJob> retrieveFineTuningJob(@Path("fine_tuning_job_id") String fineTuningJobId,
@Query("limit") Integer limit, @Query("after") String after);
/**
* Query all personal fine-tuning jobs Lists all fine-tuning jobs created by the
* current user with pagination support
* @param limit Maximum number of jobs to return per page
* @param after Cursor for pagination to get jobs after this point
* @return Paginated list of personal fine-tuning jobs
*/
@GET("fine_tuning/jobs")
Single<PersonalFineTuningJob> queryPersonalFineTuningJobs(@Query("limit") Integer limit,
@Query("after") String after);
/**
* Cancel a running fine-tuning job Stops the training process and marks the job as
* cancelled
* @param fineTuningJobId Unique identifier of the fine-tuning job to cancel
* @return Updated fine-tuning job status after cancellation
*/
@POST("fine_tuning/jobs/{fine_tuning_job_id}/cancel")
Single<FineTuningJob> cancelFineTuningJob(@Path("fine_tuning_job_id") String fineTuningJobId);
/**
* Delete a fine-tuning job Permanently removes the fine-tuning job and associated
* metadata
* @param fineTuningJobId Unique identifier of the fine-tuning job to delete
* @return Confirmation of job deletion
*/
@DELETE("fine_tuning/jobs/{fine_tuning_job_id}")
Single<FineTuningJob> deleteFineTuningJob(@Path("fine_tuning_job_id") String fineTuningJobId);
/**
* Delete a fine-tuned model Permanently removes the custom model created from
* fine-tuning
* @param fineTunedModel Identifier of the fine-tuned model to delete
* @return Status confirmation of model deletion
*/
@DELETE("fine_tuning/fine_tuned_models/{fine_tuned_model}")
Single<FineTunedModelsStatus> deleteFineTuningModel(@Path("fine_tuned_model") String fineTunedModel);

View file

@ -6,8 +6,25 @@ import io.reactivex.Single;
import retrofit2.http.Body;
import retrofit2.http.POST;
/**
* Images API for AI-powered image generation Powered by CogView-3-Plus models using
* advanced Transformer architecture Delivers high-quality text-to-image generation with
* performance comparable to industry leaders Features optimized diffusion model with
* enhanced noise planning for superior image quality Supports various image styles,
* sizes, and generation parameters with Chinese text rendering capabilities
*/
public interface ImagesApi {
/**
* Generate images from text prompts using CogView-3-Plus Creates high-quality images
* based on textual descriptions with advanced semantic understanding Supports complex
* scene composition, lighting effects, and accurate Chinese character rendering
* Optimized for both artistic creation and practical image generation needs
* @param request Image generation parameters including prompt, size, style, quality,
* and model selection
* @return Generated image URLs with metadata including generation parameters and
* quality metrics
*/
@POST("images/generations")
Single<ImageResult> createImage(@Body CreateImageRequest request);

View file

@ -15,21 +15,57 @@ import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
/**
* Knowledge Base Management API for document storage and retrieval Provides comprehensive
* knowledge base operations including creation, modification, and querying Enables AI
* models to access and utilize structured knowledge for enhanced responses
*/
public interface KnowledgeApi {
/**
* Create a new knowledge base Establishes a new knowledge repository for storing and
* organizing documents
* @param knowledgeBaseParams Configuration parameters including name, description,
* and settings
* @return Knowledge base information with ID, status, and metadata
*/
@POST("knowledge")
Single<KnowledgeInfo> knowledgeCreate(@Body KnowledgeBaseParams knowledgeBaseParams);
/**
* Modify an existing knowledge base Updates knowledge base configuration and settings
* @param knowledge_id Unique identifier of the knowledge base to modify
* @param knowledgeBaseParams Updated configuration parameters
* @return HTTP response indicating modification success or failure
*/
@PUT("knowledge/{knowledge_id}")
Single<Response<Void>> knowledgeModify(@Path("knowledge_id") String knowledge_id,
@Body KnowledgeBaseParams knowledgeBaseParams);
/**
* Query and list knowledge bases with pagination Retrieves a paginated list of
* available knowledge bases
* @param page Page number for pagination (starting from 1)
* @param size Number of knowledge bases to return per page
* @return Paginated list of knowledge bases with metadata
*/
@GET("knowledge")
Single<KnowledgePage> knowledgeQuery(@Query("page") Integer page, @Query("size") Integer size);
/**
* Delete a knowledge base Permanently removes the knowledge base and all associated
* documents
* @param knowledge_id Unique identifier of the knowledge base to delete
* @return HTTP response indicating deletion success or failure
*/
@DELETE("knowledge/{knowledge_id}")
Single<Response<Void>> knowledgeDelete(@Path("knowledge_id") String knowledge_id);
/**
* Get knowledge base usage statistics Retrieves information about storage capacity
* and usage metrics
* @return Knowledge base usage details including capacity and consumption
*/
@GET("knowledge/capacity")
Single<KnowledgeUsed> knowledgeUsed();

View file

@ -15,22 +15,86 @@ import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
/**
* Document Management API for intelligent knowledge base content Provides comprehensive
* document operations within knowledge bases for RAG (Retrieval-Augmented Generation)
* Supports document upload, automatic processing, vectorization, modification, deletion,
* and retrieval Enables efficient knowledge management for AI systems with advanced
* indexing and search capabilities Features automatic content extraction, chunking,
* embedding generation, and semantic organization
*/
public interface DocumentApi {
/**
* Create and upload a new document to knowledge base with automatic processing
* Uploads document content for intelligent processing, content extraction, and
* vectorization Supports multiple file formats (PDF, DOC, TXT, MD) with automatic
* format detection Features automatic text chunking, embedding generation, and
* semantic indexing for optimal retrieval
* @param document Multipart document data including file content, metadata, and
* processing preferences
* @return Document object with unique ID, processing status, extraction results, and
* indexing information
*/
@POST("files")
Single<DocumentObject> createDocument(@Body MultipartBody document);
/**
* Modify an existing document with intelligent reprocessing Updates document
* metadata, content, or processing settings with automatic re-indexing Supports
* content updates, metadata changes, and processing parameter adjustments Triggers
* automatic re-vectorization and re-indexing when content is modified
* @param documentId Unique identifier of the document to modify
* @param documentEditParams Updated document parameters including content, metadata,
* and processing settings
* @return HTTP response indicating modification success, processing status, and any
* validation errors
*/
@PUT("document/{document_id}")
Single<Response<Void>> modifyDocument(@Path("document_id") String documentId,
@Body DocumentEditParams documentEditParams);
/**
* Delete a document from knowledge base with complete cleanup Permanently removes the
* document, its indexed content, generated embeddings, and all associated metadata
* Ensures complete removal from vector database and search indices for data
* consistency Irreversible operation that affects knowledge base search and retrieval
* capabilities
* @param documentId Unique identifier of the document to delete
* @return HTTP response indicating deletion success, cleanup status, and any
* dependency warnings
*/
@DELETE("document/{document_id}")
Single<Response<Void>> deleteDocument(@Path("document_id") String documentId);
/**
* Query and list documents with advanced filtering and pagination Retrieves documents
* from knowledge base with comprehensive filter options and sorting Supports
* filtering by knowledge base, purpose, processing status, and content type Provides
* efficient pagination for large document collections with optimized performance
* @param knowledgeId Filter documents by specific knowledge base ID (optional)
* @param purpose Filter documents by their intended purpose or category (optional)
* @param page Page number for pagination (starts from 1)
* @param limit Maximum number of documents to return per page (recommended: 10-50)
* @param order Sort order for the document list (e.g., 'created_at', 'updated_at',
* 'name')
* @return Paginated list of documents with metadata, processing status, and summary
* information
*/
@GET("files")
Single<DocumentPage> queryDocumentList(@Query("knowledge_id") String knowledgeId, @Query("purpose") String purpose,
@Query("page") Integer page, @Query("limit") Integer limit, @Query("order") String order);
/**
* Retrieve comprehensive information about a specific document Gets detailed document
* data including content, processing status, embedding information, and usage
* statistics Provides insights into document processing results, chunk distribution,
* and retrieval performance Essential for monitoring document quality and
* troubleshooting knowledge base issues
* @param documentId Unique identifier of the document to retrieve
* @return Complete document data with content, metadata, processing details,
* embedding statistics, and access history
*/
@GET("document/{document_id}")
Single<DocumentData> retrieveDocument(@Path("document_id") String documentId);

View file

@ -9,12 +9,40 @@ import retrofit2.http.Body;
import retrofit2.http.POST;
import retrofit2.http.Streaming;
/**
* Tools API for enhanced AI capabilities and intelligent agent functions Provides access
* to external tools and services integrated with GLM-4 All Tools Enables AI models to
* access real-time information, perform web searches, and execute complex tasks Features
* intelligent tool selection, automatic parameter optimization, and result synthesis
* Supports web browsing, code interpretation, image generation, and custom tool
* integration
*/
public interface ToolsApi {
/**
* Perform intelligent web search with streaming response Executes real-time web
* search using GLM-4 enhanced query processing and streams results Features automatic
* query optimization, result filtering, and relevance ranking Provides incremental
* results for immediate processing and user feedback
* @param request Web search parameters including optimized query, result filters,
* language preferences, and streaming options
* @return Streaming response body with progressive search results, relevance scores,
* and metadata
*/
@Streaming
@POST("tools")
Call<ResponseBody> webSearchStreaming(@Body WebSearchParamsRequest request);
/**
* Perform intelligent web search with comprehensive response Executes advanced web
* search using GLM-4 All Tools with intelligent result synthesis Features automatic
* query expansion, content summarization, and quality assessment Provides structured
* results optimized for AI model consumption and reasoning
* @param request Web search parameters including query, result count, content
* filters, and processing preferences
* @return Complete web search results with URLs, content snippets, relevance scores,
* publication dates, and synthesized summaries
*/
@POST("tools")
Single<WebSearchPro> webSearch(@Body WebSearchParamsRequest request);

View file

@ -8,11 +8,35 @@ import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
/**
* Videos API for AI-powered video generation Powered by CogVideoX models using advanced
* Transformer and 3D Causal VAE architecture Supports both text-to-video and
* image-to-video generation with exceptional quality Features natural camera movements,
* semantic coherence, and photorealistic visual output Configurable parameters include
* quality, audio generation, size, and frame rate (fps)
*/
public interface VideosApi {
/**
* Generate videos from text or image prompts using CogVideoX Creates high-quality
* videos with natural camera movements and semantic coherence Supports text-to-video
* generation with detailed prompt descriptions Supports image-to-video generation
* using image_url parameter for enhanced control
* @param request Video generation parameters including prompt, image_url, quality,
* with_audio, size, and fps
* @return Video generation task information with processing status and result URLs
*/
@POST("videos/generations")
Single<VideoObject> videoGenerations(@Body VideoCreateParams request);
/**
* Retrieve the result of an asynchronous video generation Gets the generated video
* result using the task ID from video generation request Video generation is
* typically asynchronous due to computational complexity
* @param id Task ID returned from video generation request
* @return Generated video URLs with metadata including duration, resolution, and
* audio information
*/
@GET("async-result/{id}")
Single<VideoObject> videoGenerationsResult(@Path("id") String id);

View file

@ -6,8 +6,26 @@ import io.reactivex.Single;
import retrofit2.http.Body;
import retrofit2.http.POST;
/**
* Web Search API for real-time internet information retrieval Integrated with GLM-4
* models to provide comprehensive web search capabilities Enables AI models to access
* current information, news, and real-time data from the internet Supports intelligent
* search result filtering, ranking, and content summarization Features automatic query
* optimization and multi-source information aggregation
*/
public interface WebSearchApi {
/**
* Perform intelligent web search operation with GLM-4 integration Searches the
* internet for relevant, up-to-date information using advanced query processing
* Features automatic query expansion, result filtering, and content quality
* assessment Supports real-time information retrieval for news, facts, and current
* events
* @param request Web search request containing search query, result count, language
* preference, and filtering options
* @return Comprehensive web search results with URLs, titles, content snippets,
* publication dates, and relevance scores
*/
@POST("web_search")
Single<WebSearchDTO> webSearch(@Body WebSearchRequest request);

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.conversation;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@ -8,7 +7,6 @@ import lombok.Data;
* This class represents the usage data for a specific conversation.
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ConversationUsage {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.conversation;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@ -10,7 +9,6 @@ import java.util.List;
* This class represents a list of conversation usage data.
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ConversationUsageList {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.conversation;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@ -8,7 +7,6 @@ import lombok.Data;
* This class represents the response containing a list of conversation usage data.
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ConversationUsageListStatus {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.conversation;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@ -8,7 +7,6 @@ import lombok.Data;
* This class represents the usage statistics for a conversation.
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class Usage {
/**

View file

@ -1,13 +1,11 @@
package ai.z.openapi.service.assistant.message;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import ai.z.openapi.service.deserialize.JsonTypeMapping;
import ai.z.openapi.service.deserialize.assistant.message.MessageContentDeserializer;
@JsonTypeMapping({ ToolsDeltaBlock.class, TextContentBlock.class })
@JsonDeserialize(using = MessageContentDeserializer.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public abstract class MessageContent {
}

View file

@ -1,13 +1,11 @@
package ai.z.openapi.service.assistant.message;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import ai.z.openapi.service.deserialize.JsonTypeField;
/**
* This class represents a block of text content in a conversation.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonTypeField("content")
public class TextContentBlock extends MessageContent {

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.message;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import ai.z.openapi.service.assistant.message.tools.ToolsType;
import ai.z.openapi.service.deserialize.JsonTypeField;
@ -10,7 +9,6 @@ import java.util.List;
/**
* This class represents a block of tool call data in a conversation.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonTypeField("tool_calls")
public class ToolsDeltaBlock extends MessageContent {

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.message.tools.code_interpreter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import ai.z.openapi.service.assistant.message.tools.ToolsType;
import lombok.AllArgsConstructor;
@ -17,7 +16,6 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class CodeInterpreterToolBlock extends ToolsType {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.message.tools.drawing_tool;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import ai.z.openapi.service.assistant.message.tools.ToolsType;
import lombok.AllArgsConstructor;
@ -17,7 +16,6 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class DrawingToolBlock extends ToolsType {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.message.tools.function;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import ai.z.openapi.service.assistant.message.tools.ToolsType;
import lombok.AllArgsConstructor;
@ -17,7 +16,6 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class FunctionToolBlock extends ToolsType {
/**

View file

@ -1,10 +1,7 @@
package ai.z.openapi.service.assistant.message.tools.retrieval;
import ai.z.openapi.service.assistant.message.tools.ToolsType;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import ai.z.openapi.service.deserialize.JsonTypeField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -16,7 +13,6 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class RetrievalToolBlock extends ToolsType {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.message.tools.web_browser;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import ai.z.openapi.service.assistant.message.tools.ToolsType;
import lombok.AllArgsConstructor;
@ -17,7 +16,6 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class WebBrowserToolBlock extends ToolsType {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.query_support;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@ -10,7 +9,6 @@ import java.util.List;
* This class represents the details of an assistant.
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class AssistantSupport {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.assistant.query_support;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@ -10,7 +9,6 @@ import java.util.List;
* This class represents the response containing a list of assistant supports.
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class AssistantSupportStatus {
/**

View file

@ -1,12 +1,10 @@
package ai.z.openapi.service.batches;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import java.util.List;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class BatchPage {
private String object;

View file

@ -5,7 +5,6 @@ import com.fasterxml.jackson.core.JsonTokenId;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import ai.z.openapi.service.assistant.AssistantChoice;
import ai.z.openapi.service.deserialize.BaseNodeDeserializer;
@ -19,8 +18,6 @@ import java.io.IOException;
*/
public class AssistantChoiceDeserializer extends BaseNodeDeserializer<AssistantChoice> {
private final static ObjectMapper MAPPER = new ObjectMapper();
private final static AssistantChoiceDeserializer instance = new AssistantChoiceDeserializer();
public AssistantChoiceDeserializer() {

View file

@ -1,80 +0,0 @@
package ai.z.openapi.service.deserialize.assistant.message.tools;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.*;
import ai.z.openapi.service.assistant.message.tools.ToolsType;
import ai.z.openapi.service.deserialize.JsonTypeField;
import ai.z.openapi.service.deserialize.JsonTypeMapping;
import java.io.IOException;
import java.lang.reflect.Field;
public class ToolsTypeDeserializer extends JsonDeserializer<ToolsType> {
@Override
public ToolsType deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
JsonNode node = p.readValueAsTree();
// Get JsonTypeMapping annotation from MessageContent class
JsonTypeMapping mapping = ToolsType.class.getAnnotation(JsonTypeMapping.class);
if (mapping == null) {
throw new IllegalStateException("Missing JsonTypeMapping annotation on MessageContent class");
}
// Iterate through classes defined in annotation to determine suitable class based
// on annotation or static method values
for (Class<?> clazz : mapping.value()) {
JsonTypeField typeField = clazz.getAnnotation(JsonTypeField.class);
if (typeField != null && node.has(typeField.value())) {
try {
// Create instance of the class
Object obj = clazz.getDeclaredConstructor().newInstance();
// Use reflection to manually set field values
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
// field.getName() gets the value from JsonProperty annotation
// above
JsonProperty annotation = field.getAnnotation(JsonProperty.class);
String name = null;
if (annotation == null) {
name = field.getName();
}
else {
name = annotation.value();
}
if (node.has(name)) {
// Set values based on field type, assuming fields are
// primitive types or strings
if (field.getType().equals(String.class)) {
field.set(obj, node.get(name).asText());
}
else if (field.getType().equals(int.class) || field.getType().equals(Integer.class)) {
field.set(obj, node.get(name).asInt());
}
else if (field.getType().equals(boolean.class) || field.getType().equals(Boolean.class)) {
field.set(obj, node.get(name).asBoolean());
}
else {
// For other types, use ObjectMapper for direct conversion
Object o = new ObjectMapper().treeToValue(node.get(name), field.getType());
field.set(obj, o);
}
}
}
return (ToolsType) obj;
}
catch (Exception e) {
throw new RuntimeException("Error while creating instance of " + clazz.getName(), e);
}
}
}
throw new IllegalArgumentException("Cannot determine type for JSON: " + node.toString());
}
}

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.fine_turning;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import ai.z.openapi.service.model.ChatError;
import lombok.AllArgsConstructor;
@ -15,7 +14,6 @@ import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class FineTuningEvent {
private String object;

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.fine_turning;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -9,7 +8,6 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class FineTuningEventData {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.fine_turning;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -9,7 +8,6 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true) // Ignore unknown properties
public class FineTuningEventMetric {
@JsonProperty("epoch")

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.fine_turning;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import ai.z.openapi.service.model.ChatError;
import lombok.Data;
@ -11,7 +10,6 @@ import java.util.List;
* Fine-tuning job
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class FineTuningJob {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.fine_turning;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import java.util.List;
@ -9,7 +8,6 @@ import java.util.List;
* Fine-tuning job
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class PersonalFineTuningJob {
String object;

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -13,7 +12,6 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class Usage {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -14,7 +13,6 @@ import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class ZAiError {
public ZAiErrorDetails error;
@ -25,7 +23,6 @@ public class ZAiError {
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public static class ZAiErrorDetails {
/**
@ -50,7 +47,6 @@ public class ZAiError {
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public static class ContentFilter {
String level;

View file

@ -1,10 +1,8 @@
package ai.z.openapi.service.web_search;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class SearchIntentResp {
private String query;

View file

@ -1,13 +1,11 @@
package ai.z.openapi.service.web_search;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class WebSearchDTO {
/**

View file

@ -1,6 +1,5 @@
package ai.z.openapi.service.web_search;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@ -9,7 +8,6 @@ import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class WebSearchResp {
private String refer;

View file

@ -1,12 +1,10 @@
package ai.z.openapi.service.web_search;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import ai.z.openapi.core.model.ClientResponse;
import ai.z.openapi.service.model.ChatError;
import lombok.Data;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class WebSearchResponse implements ClientResponse<WebSearchDTO> {
private int code;