pub struct VectorStoreFileBuilder { /* private fields */ }Expand description
Builder for vector store file operations.
Implementations§
Source§impl VectorStoreFileBuilder
impl VectorStoreFileBuilder
Sourcepub fn new(
vector_store_id: impl Into<String>,
file_id: impl Into<String>,
) -> Self
pub fn new( vector_store_id: impl Into<String>, file_id: impl Into<String>, ) -> Self
Create a new vector store file builder.
Sourcepub fn vector_store_id(&self) -> &str
pub fn vector_store_id(&self) -> &str
Get the vector store ID.
Examples found in repository?
examples/vector_stores.rs (line 178)
138fn run_document_management_example() -> Result<(), Error> {
139 println!("\n Example 2: Document Management and Batch Operations");
140 println!("{}", "=".repeat(60));
141
142 // Simulate a large document collection
143 let document_collection = vec![
144 "file-product-docs-001",
145 "file-product-docs-002",
146 "file-api-reference-003",
147 "file-user-guide-004",
148 "file-troubleshooting-005",
149 "file-changelog-006",
150 "file-best-practices-007",
151 "file-integration-guide-008",
152 ];
153
154 // Create vector store with batch file addition
155 let doc_store = vector_store_with_files(
156 "Product Documentation Store",
157 document_collection.iter().map(|s| s.to_string()).collect(),
158 )
159 .metadata("category", "documentation")
160 .metadata("product", "api_platform")
161 .metadata("version", "v2.1")
162 .expires_after_days(180); // 6 months retention
163
164 println!(" Created documentation vector store:");
165 println!(" Name: {}", doc_store.name_ref().unwrap());
166 println!(" Documents: {} files", doc_store.file_count());
167 println!(
168 " Category: {}",
169 doc_store.metadata_ref().get("category").unwrap()
170 );
171 println!(" Retention: 180 days");
172
173 // Demonstrate individual file operations
174 let individual_file_op = add_file_to_vector_store("doc-store-123", "file-new-feature-009");
175
176 println!("\n Individual File Operations:");
177 println!(" Adding file: {}", individual_file_op.file_id());
178 println!(" To store: {}", individual_file_op.vector_store_id());
179
180 // Simulate file organization strategies
181 println!("\n Document Organization Strategies:");
182
183 let categorized_stores = vec![
184 (
185 "API Documentation",
186 vec!["file-api-ref", "file-endpoints", "file-auth"],
187 ),
188 (
189 "User Guides",
190 vec!["file-quickstart", "file-tutorials", "file-howtos"],
191 ),
192 (
193 "Technical Specs",
194 vec!["file-architecture", "file-protocols", "file-security"],
195 ),
196 (
197 "Release Notes",
198 vec!["file-changelog", "file-migration", "file-breaking-changes"],
199 ),
200 ];
201
202 for (category, files) in &categorized_stores {
203 let category_store = vector_store_with_files(
204 format!("{} Vector Store", category),
205 files.iter().map(|s| s.to_string()).collect(),
206 )
207 .metadata("category", category.to_lowercase().replace(" ", "_"))
208 .metadata("auto_managed", "true");
209
210 println!(" {}: {} files", category, category_store.file_count());
211 }
212
213 println!("\n Document Management Workflow:");
214 println!(" 1. Batch upload documents by category");
215 println!(" 2. Apply consistent metadata tagging");
216 println!(" 3. ⏰ Set appropriate retention policies");
217 println!(" 4. Enable automatic organization");
218 println!(" 5. Monitor storage usage and performance");
219
220 Ok(())
221}Sourcepub fn file_id(&self) -> &str
pub fn file_id(&self) -> &str
Get the file ID.
Examples found in repository?
examples/vector_stores.rs (line 177)
138fn run_document_management_example() -> Result<(), Error> {
139 println!("\n Example 2: Document Management and Batch Operations");
140 println!("{}", "=".repeat(60));
141
142 // Simulate a large document collection
143 let document_collection = vec![
144 "file-product-docs-001",
145 "file-product-docs-002",
146 "file-api-reference-003",
147 "file-user-guide-004",
148 "file-troubleshooting-005",
149 "file-changelog-006",
150 "file-best-practices-007",
151 "file-integration-guide-008",
152 ];
153
154 // Create vector store with batch file addition
155 let doc_store = vector_store_with_files(
156 "Product Documentation Store",
157 document_collection.iter().map(|s| s.to_string()).collect(),
158 )
159 .metadata("category", "documentation")
160 .metadata("product", "api_platform")
161 .metadata("version", "v2.1")
162 .expires_after_days(180); // 6 months retention
163
164 println!(" Created documentation vector store:");
165 println!(" Name: {}", doc_store.name_ref().unwrap());
166 println!(" Documents: {} files", doc_store.file_count());
167 println!(
168 " Category: {}",
169 doc_store.metadata_ref().get("category").unwrap()
170 );
171 println!(" Retention: 180 days");
172
173 // Demonstrate individual file operations
174 let individual_file_op = add_file_to_vector_store("doc-store-123", "file-new-feature-009");
175
176 println!("\n Individual File Operations:");
177 println!(" Adding file: {}", individual_file_op.file_id());
178 println!(" To store: {}", individual_file_op.vector_store_id());
179
180 // Simulate file organization strategies
181 println!("\n Document Organization Strategies:");
182
183 let categorized_stores = vec![
184 (
185 "API Documentation",
186 vec!["file-api-ref", "file-endpoints", "file-auth"],
187 ),
188 (
189 "User Guides",
190 vec!["file-quickstart", "file-tutorials", "file-howtos"],
191 ),
192 (
193 "Technical Specs",
194 vec!["file-architecture", "file-protocols", "file-security"],
195 ),
196 (
197 "Release Notes",
198 vec!["file-changelog", "file-migration", "file-breaking-changes"],
199 ),
200 ];
201
202 for (category, files) in &categorized_stores {
203 let category_store = vector_store_with_files(
204 format!("{} Vector Store", category),
205 files.iter().map(|s| s.to_string()).collect(),
206 )
207 .metadata("category", category.to_lowercase().replace(" ", "_"))
208 .metadata("auto_managed", "true");
209
210 println!(" {}: {} files", category, category_store.file_count());
211 }
212
213 println!("\n Document Management Workflow:");
214 println!(" 1. Batch upload documents by category");
215 println!(" 2. Apply consistent metadata tagging");
216 println!(" 3. ⏰ Set appropriate retention policies");
217 println!(" 4. Enable automatic organization");
218 println!(" 5. Monitor storage usage and performance");
219
220 Ok(())
221}Trait Implementations§
Source§impl Clone for VectorStoreFileBuilder
impl Clone for VectorStoreFileBuilder
Source§fn clone(&self) -> VectorStoreFileBuilder
fn clone(&self) -> VectorStoreFileBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for VectorStoreFileBuilder
impl RefUnwindSafe for VectorStoreFileBuilder
impl Send for VectorStoreFileBuilder
impl Sync for VectorStoreFileBuilder
impl Unpin for VectorStoreFileBuilder
impl UnsafeUnpin for VectorStoreFileBuilder
impl UnwindSafe for VectorStoreFileBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more