-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from firstbatchxyz/erhant/parser-logic-update
feat: historic messages & refactors
- Loading branch information
Showing
14 changed files
with
826 additions
and
829 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ mod nonce; | |
pub use nonce::mine_nonce; | ||
|
||
mod workflows; | ||
pub use workflows::WorkflowsExt; | ||
pub use workflows::*; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,6 @@ | ||
mod executor; | ||
pub use executor::WorkflowsExt; | ||
|
||
mod postprocess; | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use alloy::primitives::Bytes; | ||
use dkn_workflows::{Entry, Executor, Model, ProgramMemory}; | ||
|
||
#[tokio::test] | ||
#[ignore = "run this manually"] | ||
async fn test_ollama_generation() { | ||
dotenvy::dotenv().unwrap(); | ||
let executor = Executor::new(Model::Llama3_1_8B); | ||
let (output, _, _) = executor | ||
.execute_raw(&Bytes::from_static(b"What is the result of 2 + 2?"), "") | ||
.await | ||
.unwrap(); | ||
|
||
// funny test but it should pass | ||
println!("Output:\n{}", output); | ||
// assert!(output.contains('4')); // FIXME: make this use bytes | ||
} | ||
|
||
#[tokio::test] | ||
#[ignore = "run this manually"] | ||
async fn test_openai_generation() { | ||
dotenvy::dotenv().unwrap(); | ||
let executor = Executor::new(Model::Llama3_1_8B); | ||
let (output, _, _) = executor | ||
.execute_raw(&Bytes::from_static(b"What is the result of 2 + 2?"), "") | ||
.await | ||
.unwrap(); | ||
|
||
// funny test but it should pass | ||
println!("Output:\n{}", output); | ||
// assert!(output.contains('4')); // FIXME: make this use bytes | ||
} | ||
mod presets; | ||
|
||
/// Test the generation workflow with a plain input. | ||
#[tokio::test] | ||
async fn test_workflow_plain() { | ||
dotenvy::dotenv().unwrap(); | ||
let executor = Executor::new(Model::GPT4o); | ||
let mut memory = ProgramMemory::new(); | ||
let workflow = executor.get_generation_workflow().unwrap(); | ||
let input = Entry::try_value_or_str("What is 2 + 2?"); | ||
let output = executor | ||
.execute(Some(&input), workflow, &mut memory) | ||
.await | ||
.unwrap(); | ||
println!("Output:\n{}", output); | ||
} | ||
} | ||
mod requests; | ||
pub use requests::Request; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"name": "LLM generation", | ||
"description": "Directly generate text with input", | ||
"config": { | ||
"max_steps": 10, | ||
"max_time": 50, | ||
"tools": [""] | ||
}, | ||
"external_memory": { | ||
"context": [""], | ||
"question": [""], | ||
"answer": [""] | ||
}, | ||
"tasks": [ | ||
{ | ||
"id": "A", | ||
"name": "Generate with history", | ||
"description": "Expects an array of messages for generation", | ||
"messages": [], | ||
"inputs": [], | ||
"operator": "generation", | ||
"outputs": [ | ||
{ | ||
"type": "write", | ||
"key": "result", | ||
"value": "__result" | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "__end", | ||
"name": "end", | ||
"description": "End of the task", | ||
"messages": [{ "role": "user", "content": "End of the task" }], | ||
"inputs": [], | ||
"operator": "end", | ||
"outputs": [] | ||
} | ||
], | ||
"steps": [ | ||
{ | ||
"source": "A", | ||
"target": "__end" | ||
} | ||
], | ||
"return_value": { | ||
"input": { | ||
"type": "read", | ||
"key": "result" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.