Skip to content

Commit

Permalink
bump ollama workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
erhant committed Sep 30, 2024
1 parent 0db8745 commit fb10ef7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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 = [
Expand Down
15 changes: 10 additions & 5 deletions src/config/ollama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
};
Expand Down

0 comments on commit fb10ef7

Please sign in to comment.