Skip to content

Commit

Permalink
- refactor: update shinkai tools runner (#645)
Browse files Browse the repository at this point in the history
* - bump: shinkai-tools-runner 0.8.0

* - fix: shinkai tools runner version

* - fix: wrong tools runner version at lancedb
  • Loading branch information
agallardol authored Nov 7, 2024
1 parent 91d5541 commit 5537a73
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
18 changes: 11 additions & 7 deletions Cargo.lock

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

7 changes: 4 additions & 3 deletions shinkai-bin/shinkai-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "shinkai_node"
version = "0.8.13"
version = "0.8.14"
edition = "2021"
authors.workspace = true
# this causes `cargo run` in the workspace root to run this package
default-run = "shinkai_node"

[build-dependencies]
shinkai_tools_runner = { version = "0.7.19", features = ["built-in-tools"] }
shinkai_tools_runner = { version = "0.8.0", features = ["built-in-tools"] }

[features]
default = []
Expand Down Expand Up @@ -77,7 +77,8 @@ num_cpus = "1.16.0"
async-lock = "2.4.0"
governor = "0.6.3"
lru = "0.7.0"
shinkai_tools_runner = { version = "0.7.19", features = ["built-in-tools"] }
shinkai_tools_runner = { version = "0.8.0", features = ["built-in-tools"] }

console-subscriber = { version = "0.1", optional = true }
bytes = "1.7.1"
downcast-rs = "1.2.1"
Expand Down
3 changes: 1 addition & 2 deletions shinkai-bin/shinkai-node/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use std::path::PathBuf;

fn main() {
shinkai_tools_runner::copy_assets::copy_assets(
"0.7.14",
Some(PathBuf::from("../../")),
Some(PathBuf::from("./")),
Some(PathBuf::from("../../target").join(std::env::var("PROFILE").unwrap())),
)
.expect("failed to copy shinkai-tools-runner assets");
Expand Down
2 changes: 1 addition & 1 deletion shinkai-libs/shinkai-lancedb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ uuid = { version = "1.6.1", features = ["v4"] }
shinkai_tools_primitives = { workspace = true }
shinkai_vector_resources = { workspace = true }
shinkai_message_primitives = { workspace = true }
shinkai_tools_runner = { version = "0.7.19", features = ["built-in-tools"] }
shinkai_tools_runner = { version = "0.8.0", features = ["built-in-tools"] }
regex = "1"
base64 = "0.22.0"
lancedb = "0.10.0"
Expand Down
2 changes: 1 addition & 1 deletion shinkai-libs/shinkai-tools-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ reqwest = { version = "0.11.26", features = [
"stream",
] }
anyhow = "1.0.86"
shinkai_tools_runner = { version = "0.7.19" }
shinkai_tools_runner = { version = "0.8.0", features = ["built-in-tools"] }

[dependencies.serde]
version = "1.0.188"
Expand Down
18 changes: 9 additions & 9 deletions shinkai-libs/shinkai-tools-primitives/src/tools/js_tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::tools::argument::ToolArgument;
use crate::tools::error::ToolError;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_json::Value as JsonValue;
use shinkai_tools_runner::tools::deno_runner_options::DenoRunnerOptions;
use shinkai_tools_runner::tools::run_result::RunResult;
use shinkai_tools_runner::tools::shinkai_tools_backend_options::ShinkaiToolsBackendOptions;
use shinkai_tools_runner::tools::tool::Tool;
use shinkai_vector_resources::embeddings::Embedding;
use tokio::runtime::Runtime;
Expand All @@ -29,7 +29,11 @@ pub struct JSTool {
}

impl JSTool {
pub fn run(&self, parameters: serde_json::Map<String, serde_json::Value>, extra_config: Option<String>) -> Result<RunResult, ToolError> {
pub fn run(
&self,
parameters: serde_json::Map<String, serde_json::Value>,
extra_config: Option<String>,
) -> Result<RunResult, ToolError> {
println!("Running JSTool named: {}", self.name);
println!("Running JSTool with input: {:?}", parameters);
println!("Running JSTool with extra_config: {:?}", extra_config);
Expand Down Expand Up @@ -73,14 +77,10 @@ impl JSTool {
let tool = Tool::new(
code,
config_json,
Some(ShinkaiToolsBackendOptions {
binary_path: PathBuf::from(env::var("SHINKAI_TOOLS_BACKEND_BINARY_PATH").unwrap_or_else(
|_| "./shinkai-tools-runner-resources/shinkai-tools-backend".to_string(),
Some(DenoRunnerOptions {
binary_path: PathBuf::from(env::var("SHINKAI_TOOLS_RUNNER_DENO_BINARY_PATH").unwrap_or_else(
|_| "./shinkai-tools-runner-resources/deno".to_string(),
)),
api_port: env::var("SHINKAI_TOOLS_BACKEND_API_PORT")
.unwrap_or_else(|_| "9650".to_string())
.parse::<u16>()
.unwrap_or(9650),
}),
);
// TODO: Fix this object wrap after update tools library to have th right typification
Expand Down

0 comments on commit 5537a73

Please sign in to comment.