init
This commit is contained in:
28
src/agents/crypto_market.rs
Normal file
28
src/agents/crypto_market.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
use tokio::process::Child;
|
||||
use tracing;
|
||||
|
||||
use crate::utils::utils::run_agent;
|
||||
|
||||
pub async fn finance_query_agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
run_agent(stream_id, input, "./packages/genaiscript/genaisrc/finance-query.genai.mts").await
|
||||
}
|
||||
|
||||
|
||||
// #[cfg(test)]
|
||||
// mod tests {
|
||||
// use std::fmt::Debug;
|
||||
// use crate::agents::search::search_agent;
|
||||
//
|
||||
// #[tokio::test] // Mark the test function as async
|
||||
// async fn test_search_execution() {
|
||||
// let input = "Who won the 2024 presidential election?";
|
||||
//
|
||||
// let mut command = search_agent("test-stream", input).await.unwrap();
|
||||
//
|
||||
// // command.stdout.take().unwrap().read_to_string(&mut String::new()).await.unwrap();
|
||||
// // Optionally, you can capture and inspect stdout if needed:
|
||||
// let output = command.wait_with_output().await.expect("Failed to wait for output");
|
||||
// println!("Stdout: {}", String::from_utf8_lossy(&output.stdout));
|
||||
// println!("Stderr: {}", String::from_utf8_lossy(&output.stderr));
|
||||
// }
|
||||
// }
|
10
src/agents/image_generator.rs
Normal file
10
src/agents/image_generator.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
use crate::utils::utils::run_agent;
|
||||
use tokio::process::Child;
|
||||
|
||||
pub async fn image_generator(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
tracing::debug!(
|
||||
"Running image generator, \ninput: {}",
|
||||
input
|
||||
);
|
||||
run_agent(stream_id, input, "./packages/genaiscript/genaisrc/image-generator.genai.mts").await
|
||||
}
|
5
src/agents/mod.rs
Normal file
5
src/agents/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
pub mod news;
|
||||
pub mod scrape;
|
||||
pub mod search;
|
||||
pub mod image_generator;
|
||||
pub mod crypto_market;
|
6
src/agents/news.rs
Normal file
6
src/agents/news.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
use crate::utils::utils::run_agent;
|
||||
use tokio::process::Child;
|
||||
|
||||
pub async fn news_agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
run_agent(stream_id, input, "./packages/genaiscript/genaisrc/news-search.genai.mts").await
|
||||
}
|
6
src/agents/scrape.rs
Normal file
6
src/agents/scrape.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
use crate::utils::utils::run_agent;
|
||||
use tokio::process::Child;
|
||||
|
||||
pub async fn scrape_agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
run_agent(stream_id, input, "./packages/genaiscript/genaisrc/web-scrape.genai.mts").await
|
||||
}
|
28
src/agents/search.rs
Normal file
28
src/agents/search.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
use tokio::process::Child;
|
||||
use tracing;
|
||||
|
||||
use crate::utils::utils::run_agent;
|
||||
|
||||
pub async fn search_agent(stream_id: &str, input: &str) -> Result<Child, String> {
|
||||
run_agent(stream_id, input, "./packages/genaiscript/genaisrc/web-search.genai.mts").await
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::fmt::Debug;
|
||||
use crate::agents::search::search_agent;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_search_execution() {
|
||||
let input = "Who won the 2024 presidential election?";
|
||||
|
||||
let mut command = search_agent("test-stream", input).await.unwrap();
|
||||
|
||||
// command.stdout.take().unwrap().read_to_string(&mut String::new()).await.unwrap();
|
||||
// Optionally, you can capture and inspect stdout if needed:
|
||||
let output = command.wait_with_output().await.expect("Failed to wait for output");
|
||||
println!("Stdout: {}", String::from_utf8_lossy(&output.stdout));
|
||||
println!("Stderr: {}", String::from_utf8_lossy(&output.stderr));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user