Skip to content

Commit

Permalink
- fix: shinkai tools backend location (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
agallardol authored Aug 29, 2024
1 parent fd21f0b commit b616977
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions shinkai-bin/shinkai-node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shinkai_node"
version = "0.7.32"
version = "0.7.33"
edition = "2021"
authors.workspace = true
# this causes `cargo run` in the workspace root to run this package
Expand All @@ -22,7 +22,7 @@ doctest = false
[build-dependencies]
prost-build = "0.8.0"
reqwest = { version = "0.11.26", features = ["json", "tokio-native-tls", "blocking", "stream"] }
shinkai_tools_runner = { version = "0.7.4" } # change to a crate later on
shinkai_tools_runner = { version = "0.7.5" } # change to a crate later on

[dependencies]
async-trait = "0.1.74"
Expand Down Expand Up @@ -83,7 +83,7 @@ minidom = "0.12"
rust_decimal = "1.17.0"
aws-types = "1.2.0"
aws-config = { version = "1.2.1", features = ["behavior-version-latest"] }
shinkai_tools_runner = { version = "0.7.4", features = ["built-in-tools"] } # If you change this version you need to change the build.rs hardcoded version
shinkai_tools_runner = { version = "0.7.5", features = ["built-in-tools"] } # If you change this version you need to change the build.rs hardcoded version
scraper = "0.12.0" # remove later on
html2md = "0.2.14" # remove later on
lancedb = "0.8.0"
Expand Down
2 changes: 1 addition & 1 deletion shinkai-bin/shinkai-node/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::path::PathBuf;

fn main() {
shinkai_tools_runner::copy_assets::copy_assets(
"0.7.4",
"0.7.5",
Some(PathBuf::from("../../")),
Some(PathBuf::from("../../target").join(std::env::var("PROFILE").unwrap())),
)
Expand Down
18 changes: 16 additions & 2 deletions shinkai-bin/shinkai-node/src/tools/js_tools.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use std::collections::HashMap;
use std::thread;
use std::path::PathBuf;
use std::{env, thread};

use super::js_toolkit_headers::ToolConfig;
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::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 Down Expand Up @@ -62,7 +64,19 @@ impl JSTool {
rt.block_on(async {
eprintln!("Running JSTool with config: {:?}", config);
eprintln!("Running JSTool with input: {}", input);
let tool = Tool::new(code, config_json);
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(),
)),
api_port: env::var("SHINKAI_TOOLS_BACKEND_API_PORT")
.unwrap_or_else(|_| "9650".to_string())
.parse::<u16>()
.unwrap_or(9650),
}),
);
tool.run(serde_json::from_str(&input).unwrap(), None)
.await
.map_err(|e| ToolError::ExecutionError(e.to_string()))
Expand Down

0 comments on commit b616977

Please sign in to comment.