Skip to content

Commit

Permalink
Merge pull request #20 from erhant/main
Browse files Browse the repository at this point in the history
chore: Workflow as reference
  • Loading branch information
andthattoo authored Nov 1, 2024
2 parents a0b5efb + 0d29d14 commit 72b090f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/execute_workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async fn main() {
let workflow = Workflow::new_from_json("./workflows/search.json").unwrap();
let mut memory = ProgramMemory::new();
let input = Entry::try_value_or_str("How would does reiki work?");
let return_value = exe.execute(Some(&input), workflow, &mut memory).await;
let return_value = exe.execute(Some(&input), &workflow, &mut memory).await;
match return_value {
Ok(value) => println!("{}", value),
Err(err) => eprintln!("Error: {:?}", err),
Expand Down
2 changes: 1 addition & 1 deletion src/program/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Executor {
pub async fn execute(
&self,
input: Option<&Entry>,
workflow: Workflow,
workflow: &Workflow,
memory: &mut ProgramMemory,
) -> Result<String, ExecutionError> {
let config = workflow.get_config();
Expand Down
4 changes: 2 additions & 2 deletions tests/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ macro_rules! workflow_test {
let workflow = Workflow::new_from_json($workflow).unwrap();
let mut memory = ProgramMemory::new();
let input = Entry::try_value_or_str($input);
if let Err(e) = exe.execute(Some(&input), workflow, &mut memory).await {
if let Err(e) = exe.execute(Some(&input), &workflow, &mut memory).await {
log::error!("Execution failed: {}", e);
};
}
Expand All @@ -44,7 +44,7 @@ macro_rules! workflow_test {
let exe = setup_test($model).await;
let workflow = Workflow::new_from_json($workflow).unwrap();
let mut memory = ProgramMemory::new();
if let Err(e) = exe.execute(None, workflow, &mut memory).await {
if let Err(e) = exe.execute(None, &workflow, &mut memory).await {
log::error!("Execution failed: {}", e);
};
}
Expand Down

0 comments on commit 72b090f

Please sign in to comment.