1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
//! # Knowledge Base Module
//!
//! Provides comprehensive knowledge base management capabilities for the Zhipu
//! AI API. Knowledge bases allow you to upload documents and use them as
//! context for AI conversations.
//!
//! ## Module Components
//!
//! ### Knowledge Management
//! - [`create`] - Create new knowledge bases
//! - [`list`] - List existing knowledge bases
//! - [`retrieve`] - Retrieve knowledge base details
//! - [`update`] - Update knowledge base metadata
//! - [`delete`] - Delete knowledge bases
//! - [`capacity`] - Check knowledge base capacity and usage
//!
//! ### Document Management
//! - [`document_upload_file`] - Upload documents from local files
//! - [`document_upload_url`] - Upload documents from URLs
//! - [`document_list`] - List documents in a knowledge base
//! - [`document_retrieve`] - Retrieve document details
//! - [`document_delete`] - Delete documents
//! - [`document_image_list`] - List images in documents
//! - [`document_reembedding`] - Re-embed documents
//!
//! ### Knowledge Retrieval
//! - [`retrieve`] - Retrieve relevant content from knowledge base
//!
//! - [`types`] - Shared data types
//!
//! ## Supported Operations
//!
//! ### Create Knowledge Base
//! ```rust,ignore
//! use zai_rs::knowledge::{CreateKnowledgeRequest, CreateKnowledgeBody, KnowledgeIcon};
//!
//! let body = CreateKnowledgeBody {
//! name: "My Knowledge Base".to_string(),
//! description: Some("Documentation for my project".to_string()),
//! icon: KnowledgeIcon::Text,
//! background_color: None,
//! permission: None,
//! embedding_id: None,
//! };
//!
//! let request = CreateKnowledgeRequest::new(body);
//! let response = client.create_knowledge(&request).await?;
//! ```
//!
//! ### Upload Document
//! ```rust,ignore
//! use zai_rs::knowledge::{DocumentUploadFileRequest, UploadFileOptions};
//! use tokio::fs::File;
//!
//! let file = File::open("document.pdf").await?;
//! let options = UploadFileOptions {
//! chunk_size: None,
//! slice_type: None,
//! };
//!
//! let request = DocumentUploadFileRequest::new(knowledge_id, file, options);
//! let response = client.upload_document(&request).await?;
//! ```
//!
//! ### List Documents
//! ```rust,ignore
//! use zai_rs::knowledge::{DocumentListRequest, DocumentListQuery};
//!
//! let query = DocumentListQuery {
//! limit: Some(20),
//! page: Some(1),
//! };
//!
//! let request = DocumentListRequest::new(knowledge_id, query);
//! let response = client.list_documents(&request).await?;
//! ```
//!
//! ### Delete Document
//! ```rust,ignore
//! use zai_rs::knowledge::{DocumentDeleteRequest, DocumentDeleteBody};
//!
//! let body = DocumentDeleteBody {
//! document_ids: vec!["doc_123".to_string(), "doc_456".to_string()],
//! };
//!
//! let request = DocumentDeleteRequest::new(knowledge_id, body);
//! let response = client.delete_documents(&request).await?;
//! ```
//!
//! ### Retrieve Knowledge
//! ```rust,ignore
//! use zai_rs::knowledge::{KnowledgeRetrieveRequest, KnowledgeRetrieveBody};
//!
//! let body = KnowledgeRetrieveBody {
//! question: "How do I use the API?".to_string(),
//! top_k: Some(3),
//! };
//!
//! let request = KnowledgeRetrieveRequest::new(knowledge_id, body);
//! let response = client.retrieve_knowledge(&request).await?;
//! ```
//!
//! ## Use Cases
//!
//! - **Document Q&A**: Upload documentation and ask questions about it
//! - **Knowledge Search**: Search across multiple documents efficiently
//! - **Context Enhancement**: Provide context to AI conversations
//! - **Document Management**: Organize and manage document collections
//!
//! ## Supported Document Types
//!
//! - PDF documents
//! - Plain text files
//! - Markdown files
//! - Word documents
//! - HTML pages
//!
//! ## Knowledge Base Features
//!
//! - Automatic text extraction and segmentation
//! - Vector embedding for semantic search
//! - Re-embedding capability for updated documents
//! - Image extraction from documents
//! - Usage tracking and capacity management
pub use KnowledgeCapacityRequest;
pub use ;
pub use ;
pub use ;
pub use DocumentImageListRequest;
pub use ;
pub use ;
pub use DocumentRetrieveRequest;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;