Skip to main content

VectorStoreFileBuilder

Struct VectorStoreFileBuilder 

Source
pub struct VectorStoreFileBuilder { /* private fields */ }
Expand description

Builder for vector store file operations.

Implementations§

Source§

impl VectorStoreFileBuilder

Source

pub fn new( vector_store_id: impl Into<String>, file_id: impl Into<String>, ) -> Self

Create a new vector store file builder.

Source

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}
Source

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

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for VectorStoreFileBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more