From 1f6010b0c3450084eb42cc8a8d95e1c55a21bf98 Mon Sep 17 00:00:00 2001 From: Timon Vonk Date: Sat, 11 Jan 2025 22:16:44 +0100 Subject: [PATCH] Fix tests / docs / pipeline --- .github/workflows/test.yml | 2 +- Cargo.lock | 16 ---------------- Cargo.toml | 1 - swiftide-agents/src/lib.rs | 2 +- .../src/search_strategies/custom_strategy.rs | 2 +- swiftide-integrations/Cargo.toml | 5 ++--- swiftide-integrations/src/ollama/config.rs | 10 +++++++++- 7 files changed, 14 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d50b1e91..b674c649 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,4 +28,4 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} - name: "Test" - run: cargo test -j 2 --all-features --tests + run: cargo test -j 2 --all-features --no-fail-fast diff --git a/Cargo.lock b/Cargo.lock index 5dc43918..3d6571b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5940,21 +5940,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "ollama-rs" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763afb01db2dced00e656cc2cdcd875659fc3fac4c449e6337a4f04f9e3d9efc" -dependencies = [ - "async-stream", - "async-trait", - "log", - "reqwest", - "serde", - "serde_json", - "url", -] - [[package]] name = "once_cell" version = "1.20.2" @@ -8690,7 +8675,6 @@ dependencies = [ "itertools 0.13.0", "lancedb", "mockall", - "ollama-rs", "parquet", "pgvector", "qdrant-client", diff --git a/Cargo.toml b/Cargo.toml index b84e0f99..ade3c0d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,7 +67,6 @@ fastembed = "4.4" flv-util = "0.5.2" htmd = "0.1" ignore = "0.4" -ollama-rs = "0.2.2" proc-macro2 = "1.0" quote = "1.0" redis = "0.27" diff --git a/swiftide-agents/src/lib.rs b/swiftide-agents/src/lib.rs index 2fa5b452..41abe4c6 100644 --- a/swiftide-agents/src/lib.rs +++ b/swiftide-agents/src/lib.rs @@ -11,7 +11,7 @@ //! //! # Example //! -//! ```no_run +//! ```ignore //! # use swiftide_agents::Agent; //! # use swiftide_integrations as integrations; //! # async fn run() -> Result<(), Box> { diff --git a/swiftide-core/src/search_strategies/custom_strategy.rs b/swiftide-core/src/search_strategies/custom_strategy.rs index ac0e221e..d2e9ea6c 100644 --- a/swiftide-core/src/search_strategies/custom_strategy.rs +++ b/swiftide-core/src/search_strategies/custom_strategy.rs @@ -33,7 +33,7 @@ type QueryGenerator = Arc) -> Result + Send /// * `Q` - The retriever-specific query type (e.g., `sqlx::QueryBuilder` for `PostgreSQL`) /// /// # Examples -/// ```rust +/// ```ignore /// // Define search configuration /// const MAX_SEARCH_RESULTS: i64 = 5; /// diff --git a/swiftide-integrations/Cargo.toml b/swiftide-integrations/Cargo.toml index d7b21f72..6eb2a6d1 100644 --- a/swiftide-integrations/Cargo.toml +++ b/swiftide-integrations/Cargo.toml @@ -67,7 +67,6 @@ aws-sdk-bedrockruntime = { workspace = true, features = [ ], optional = true } secrecy = { workspace = true, optional = true } reqwest = { workspace = true, optional = true } -ollama-rs = { workspace = true, optional = true } deadpool = { workspace = true, features = [ "managed", "rt_tokio_1", @@ -127,8 +126,8 @@ tree-sitter = [ openai = ["dep:async-openai"] # Groq prompting groq = ["dep:async-openai", "dep:secrecy", "dep:reqwest"] -# Ollama prompting -ollama = ["dep:ollama-rs"] +# Ollama prompting, embedding, chatcompletion +ollama = ["dep:async-openai", "dep:secrecy", "dep:reqwest"] # FastEmbed (by qdrant) for fast, local embeddings fastembed = ["dep:fastembed"] # Scraping via spider as loader and a html to markdown transformer diff --git a/swiftide-integrations/src/ollama/config.rs b/swiftide-integrations/src/ollama/config.rs index ca3fa32e..3a1f350d 100644 --- a/swiftide-integrations/src/ollama/config.rs +++ b/swiftide-integrations/src/ollama/config.rs @@ -2,7 +2,7 @@ use reqwest::header::HeaderMap; use secrecy::Secret; use serde::Deserialize; -const OLLAMA_API_BASE: &str = "http://localhost:11434"; +const OLLAMA_API_BASE: &str = "http://localhost:11434/v1"; #[derive(Clone, Debug, Deserialize)] #[serde(default)] @@ -11,6 +11,14 @@ pub struct OllamaConfig { api_key: Secret, } +impl OllamaConfig { + pub fn with_api_base(&mut self, api_base: &str) -> &mut Self { + self.api_base = api_base.to_string(); + + self + } +} + impl Default for OllamaConfig { fn default() -> Self { Self {