Skip to content

Commit 6852923

Browse files
committed
refactor(client): remove Engine::builder() method and update imports
- Remove the deprecated Engine::builder() method from the Engine struct - Update all examples to use EngineBuilder::new() instead of Engine::builder() - Update import statements to remove Engine from client module exports - Update documentation examples to reflect the new EngineBuilder usage - Update README.md to remove Engine from the import statement
1 parent 321aca5 commit 6852923

9 files changed

Lines changed: 19 additions & 42 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ vectorless = "0.1"
6060
```
6161

6262
```rust
63-
use vectorless::client::{Engine, EngineBuilder, IndexContext};
63+
use vectorless::client::{EngineBuilder, IndexContext};
6464

6565
#[tokio::main]
6666
async fn main() -> vectorless::Result<()> {

examples/rust/advanced.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
//! cargo run --example advanced
1717
//! ```
1818
19-
use vectorless::{Engine, IndexContext};
19+
use vectorless::{EngineBuilder, IndexContext};
2020

2121
#[tokio::main]
2222
async fn main() -> vectorless::Result<()> {
2323
println!("=== Vectorless Advanced Example (Full Configuration) ===\n");
2424

2525
// Method 1: Use explicit config file path
2626
// This loads all settings from the specified config file
27-
let client = Engine::builder()
27+
let client = EngineBuilder::new()
2828
.with_config_path("./config.toml") // or "./my_vectorless.toml"
2929
.build()
3030
.await

examples/rust/basic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
//! cargo run --example basic
1212
//! ```
1313
14-
use vectorless::{Engine, IndexContext};
14+
use vectorless::{EngineBuilder, IndexContext};
1515

1616
#[tokio::main]
1717
async fn main() -> vectorless::Result<()> {
1818
println!("=== Vectorless Basic Example ===\n");
1919

2020
// 1. Create a client
21-
let client = Engine::builder()
21+
let client = EngineBuilder::new()
2222
.with_workspace("./workspace")
2323
.build()
2424
.await

examples/rust/batch_processing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ vectorless --version
775775
4. Query!
776776
777777
```rust
778-
let client = Engine::builder().build()?;
778+
let client = EngineBuilder::new().build()?;
779779
let doc_id = client.index("./doc.md").await?;
780780
let result = client.query(&doc_id, "What is this?").await?;
781781
```

examples/rust/custom_config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! cargo run --example custom_config
1313
//! ```
1414
15-
use vectorless::{Engine, IndexContext};
15+
use vectorless::{EngineBuilder, IndexContext};
1616

1717
#[tokio::main]
1818
async fn main() -> vectorless::Result<()> {
@@ -32,7 +32,7 @@ async fn main() -> vectorless::Result<()> {
3232
// ============================================================
3333

3434
// Example: Use DeepSeek API
35-
let client = Engine::builder()
35+
let client = EngineBuilder::new()
3636
.with_workspace("./workspace")
3737
.with_model("deepseek-chat", Some("sk-your-deepseek-key".to_string()))
3838
.with_endpoint("https://api.deepseek.com/v1")
@@ -64,23 +64,23 @@ async fn main() -> vectorless::Result<()> {
6464
// ============================================================
6565

6666
// Azure OpenAI:
67-
// let client = Engine::builder()
67+
// let client = EngineBuilder::new()
6868
// .with_workspace("./workspace")
6969
// .with_model("gpt-4o", Some("your-azure-key".to_string()))
7070
// .with_endpoint("https://your-resource.openai.azure.com/openai/deployments/your-deployment")
7171
// .build()
7272
// .await?;
7373

7474
// Local LLM (e.g., Ollama with OpenAI-compatible API):
75-
// let client = Engine::builder()
75+
// let client = EngineBuilder::new()
7676
// .with_workspace("./workspace")
7777
// .with_model("llama3", None) // No API key needed
7878
// .with_endpoint("http://localhost:11434/v1")
7979
// .build()
8080
// .await?;
8181

8282
// Anthropic Claude (via OpenAI-compatible proxy):
83-
// let client = Engine::builder()
83+
// let client = EngineBuilder::new()
8484
// .with_workspace("./workspace")
8585
// .with_model("claude-3-5-sonnet-20241022", Some("sk-ant-...".to_string()))
8686
// .with_endpoint("https://api.anthropic.com/v1")

examples/rust/custom_pilot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ fn main() {
242242
println!("use vectorless::Engine;");
243243
println!();
244244
println!("let pilot = Arc::new(KeywordPilot::new());");
245-
println!("let engine = Engine::builder()");
245+
println!("let engine = EngineBuilder::new()");
246246
println!(" .with_workspace(\"./workspace\")");
247247
println!(" .with_pilot(pilot)");
248248
println!(" .build()");

examples/rust/markdownflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//! OPENAI_API_KEY=sk-... cargo run --example markdown_flow
2020
//! ```
2121
22-
use vectorless::Engine;
22+
use vectorless::EngineBuilder;
2323
use vectorless::client::{IndexContext, IndexOptions};
2424

2525
/// Sample markdown content for demonstration.
@@ -43,7 +43,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
4343
// Step 1: Create a Vectorless client (no API key needed - LLM config is automatic)
4444
println!("Step 1: Creating Vectorless client...");
4545

46-
let client = Engine::builder()
46+
let client = EngineBuilder::new()
4747
.with_workspace("./workspace")
4848
.build()
4949
.await

rust/src/client/engine.rs

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//! # Example
2020
//!
2121
//! ```rust,no_run
22-
//! use vectorless::client::{Engine, EngineBuilder, IndexContext};
22+
//! use vectorless::client::{EngineBuilder, IndexContext};
2323
//!
2424
//! # #[tokio::main]
2525
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -98,29 +98,6 @@ pub struct Engine {
9898
}
9999

100100
impl Engine {
101-
/// Create a builder for custom configuration.
102-
#[must_use]
103-
pub fn builder() -> super::EngineBuilder {
104-
super::EngineBuilder::new()
105-
}
106-
107-
/// Create a new client with default configuration.
108-
///
109-
/// Note: Prefer using [`Engine::builder()`] for more control.
110-
async fn new() -> Result<Self> {
111-
let config = Config::default();
112-
let workspace = Workspace::new("./workspace")
113-
.await
114-
.map_err(|e| Error::Workspace(e.to_string()))?;
115-
Self::with_components(
116-
config,
117-
workspace,
118-
PipelineRetriever::new(),
119-
PipelineExecutor::new(),
120-
)
121-
.await
122-
}
123-
124101
// ============================================================
125102
// Constructor (for Builder)
126103
// ============================================================
@@ -184,7 +161,7 @@ impl Engine {
184161
/// # Example
185162
///
186163
/// ```rust,no_run
187-
/// use vectorless::client::{Engine, EngineBuilder, IndexContext, IndexMode};
164+
/// use vectorless::client::{EngineBuilder, IndexContext, IndexMode};
188165
/// use vectorless::parser::DocumentFormat;
189166
///
190167
/// # #[tokio::main]
@@ -596,11 +573,11 @@ impl std::fmt::Debug for Engine {
596573

597574
#[cfg(test)]
598575
mod tests {
599-
use super::*;
576+
use super::super::EngineBuilder;
600577

601578
#[test]
602579
fn test_engine_builder() {
603-
let builder = Engine::builder();
580+
let builder = EngineBuilder::new();
604581
// Builder exists
605582
let _ = builder;
606583
}

rust/src/client/index_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl IndexSource {
149149
/// # Examples
150150
///
151151
/// ```rust,no_run
152-
/// use vectorless::client::{Engine, EngineBuilder, IndexContext, IndexMode};
152+
/// use vectorless::client::{EngineBuilder, IndexContext, IndexMode};
153153
/// use vectorless::parser::DocumentFormat;
154154
///
155155
/// # #[tokio::main]

0 commit comments

Comments
 (0)