From fb10ef780ac836a554fe346aea54adbf9cc09d6f Mon Sep 17 00:00:00 2001 From: erhant Date: Mon, 30 Sep 2024 09:58:23 +0300 Subject: [PATCH] bump ollama workflows --- Cargo.lock | 8 ++++---- Cargo.toml | 4 ++-- src/config/ollama.rs | 15 ++++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index caeef99..e66b588 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1035,7 +1035,7 @@ dependencies = [ [[package]] name = "dkn-compute" -version = "0.2.4" +version = "0.2.5" dependencies = [ "async-trait", "base64 0.22.1", @@ -3440,8 +3440,8 @@ dependencies = [ [[package]] name = "ollama-rs" -version = "0.2.0" -source = "git+https://github.com/andthattoo/ollama-rs?rev=e566515#e56651586c468546a46a995e3176539396d85243" +version = "0.2.1" +source = "git+https://github.com/andthattoo/ollama-rs?rev=00c67cf#00c67cf362c5baa8178906b526605cafadcdbd6e" dependencies = [ "async-stream", "async-trait", @@ -3458,7 +3458,7 @@ dependencies = [ [[package]] name = "ollama-workflows" version = "0.1.0" -source = "git+https://github.com/andthattoo/ollama-workflows?rev=320d923#320d9231a00515e9bf0dde7f8a3202ef84192a7b" +source = "git+https://github.com/andthattoo/ollama-workflows?rev=09f8579#09f8579d7cff2ca0a644f82ab0232ae6ba2269c3" dependencies = [ "async-trait", "colored", diff --git a/Cargo.toml b/Cargo.toml index 0d02f6a..1e2586e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dkn-compute" -version = "0.2.4" +version = "0.2.5" edition = "2021" license = "Apache-2.0" readme = "README.md" @@ -45,7 +45,7 @@ sha3 = "0.10.8" fastbloom-rs = "0.5.9" # workflows -ollama-workflows = { git = "https://github.com/andthattoo/ollama-workflows", rev = "320d923" } +ollama-workflows = { git = "https://github.com/andthattoo/ollama-workflows", rev = "09f8579" } # peer-to-peer libp2p = { git = "https://github.com/anilaltuner/rust-libp2p.git", rev = "7ce9f9e", features = [ diff --git a/src/config/ollama.rs b/src/config/ollama.rs index 3f495ef..bc43944 100644 --- a/src/config/ollama.rs +++ b/src/config/ollama.rs @@ -2,7 +2,11 @@ use std::time::Duration; use ollama_workflows::{ ollama_rs::{ - generation::{completion::request::GenerationRequest, options::GenerationOptions}, + generation::{ + completion::request::GenerationRequest, + embeddings::request::{EmbeddingsInput, GenerateEmbeddingsRequest}, + options::GenerationOptions, + }, Ollama, }, Model, @@ -169,10 +173,11 @@ impl OllamaConfig { log::info!("Testing model {}", model); // first generate a dummy embedding to load the model into memory (warm-up) - if let Err(err) = ollama - .generate_embeddings(model.to_string(), "foobar".to_string(), Default::default()) - .await - { + let request = GenerateEmbeddingsRequest::new( + model.to_string(), + EmbeddingsInput::Single("embedme".into()), + ); + if let Err(err) = ollama.generate_embeddings(request).await { log::error!("Failed to generate embedding for model {}: {}", model, err); return false; };