From ece2dda513a67592436576671bdfad7b94babeb9 Mon Sep 17 00:00:00 2001 From: Guillermo Valin Date: Mon, 23 Dec 2024 18:34:43 -0300 Subject: [PATCH 1/3] Save embeddings in tool data --- shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs b/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs index 297ff748d..c1ed8030e 100644 --- a/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs +++ b/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs @@ -3,7 +3,8 @@ use bytemuck::cast_slice; use keyphrases::KeyPhraseExtractor; use rusqlite::{params, Result}; use shinkai_tools_primitives::tools::shinkai_tool::{ShinkaiTool, ShinkaiToolHeader}; -use std::collections::HashSet; +use std::{collections::HashSet, string}; +use shinkai_vector_resources::embeddings::Embedding; impl SqliteManager { // Adds a ShinkaiTool entry to the shinkai_tools table @@ -44,6 +45,8 @@ impl SqliteManager { // Clone the tool to make it mutable let mut tool_clone = tool.clone(); + tool_clone.set_embedding(Embedding::new("", embedding.clone())); + // Determine if the tool can be enabled let is_enabled = tool_clone.is_enabled() && tool_clone.can_be_enabled(); From 1d26d5d0aec00254c979428d5c1f77b6a91cb380 Mon Sep 17 00:00:00 2001 From: Guillermo Valin Date: Mon, 23 Dec 2024 18:35:58 -0300 Subject: [PATCH 2/3] Remove unused import. --- shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs b/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs index c1ed8030e..39fcaf066 100644 --- a/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs +++ b/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs @@ -3,7 +3,7 @@ use bytemuck::cast_slice; use keyphrases::KeyPhraseExtractor; use rusqlite::{params, Result}; use shinkai_tools_primitives::tools::shinkai_tool::{ShinkaiTool, ShinkaiToolHeader}; -use std::{collections::HashSet, string}; +use std::collections::HashSet; use shinkai_vector_resources::embeddings::Embedding; impl SqliteManager { From 5ce8af3a86b172313e5dc0db8690351b06cfda90 Mon Sep 17 00:00:00 2001 From: Guillermo Valin Date: Mon, 23 Dec 2024 18:36:37 -0300 Subject: [PATCH 3/3] Remove extra line. --- shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs b/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs index 39fcaf066..22dc65caf 100644 --- a/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs +++ b/shinkai-libs/shinkai-sqlite/src/shinkai_tool_manager.rs @@ -47,7 +47,6 @@ impl SqliteManager { let mut tool_clone = tool.clone(); tool_clone.set_embedding(Embedding::new("", embedding.clone())); - // Determine if the tool can be enabled let is_enabled = tool_clone.is_enabled() && tool_clone.can_be_enabled(); if tool_clone.is_enabled() && !tool_clone.can_be_enabled() {