Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 12 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ gix = { version = "0.83", features = ["blocking-network-client", "worktree-mutat
# "generate" feature that gates pack writing. Repacking the lore
# archives needs it.
gix-pack = { version = "0.70", default-features = false, features = ["generate", "streaming-input"] }
model2vec-rs = "0.1.4"
model2vec-rs = "0.5.0"
tower-lsp-server = "0.23" # Language Server Protocol framework for LSP server
similar = { version = "3.2", features = ["text"] } # Proper diff algorithm for commit diffs
shlex = "2.0" # Shell-like parsing for quoted strings in CLI
Expand Down
8 changes: 5 additions & 3 deletions src/vectorizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ impl CodeVectorizer {
pub async fn new_with_config(_use_gpu: bool, model_path: Option<String>) -> Result<Self> {
// model2vec-rs doesn't use GPU acceleration, so we ignore the gpu flag

// Download and setup model
let model = Self::load_model(model_path).await?;
// Preserve the 512-token limit for single-input encodes.
let model = Self::load_model(model_path)
.await?
.with_max_length(Some(512));

tracing::info!("Initialized CodeVectorizer using model2vec-rs");

Expand Down Expand Up @@ -121,7 +123,7 @@ impl CodeVectorizer {
let batch_size = get_batch_size();
let vectors = self
.model
.encode_with_args(&processed_snippets, None, batch_size);
.encode_with_args(&processed_snippets, None, batch_size, None);

// Verify all vectors have the expected dimension
for (i, vector) in vectors.iter().enumerate() {
Expand Down