Skip to content

Commit

Permalink
Merge pull request #25 from erhant/main
Browse files Browse the repository at this point in the history
small typo fix, export `MessageInput` and `Task`
  • Loading branch information
andthattoo authored Nov 17, 2024
2 parents 6cf5c5e + 4fb51cb commit 04c6f76
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ pub use program::{
models::{Model, ModelProvider},
workflow::Workflow,
};

pub use program::atomics::{MessageInput, Task};
4 changes: 2 additions & 2 deletions src/program/workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ impl Workflow {
&self.tasks
}
/// Returns a mutable reference to the tasks of the workflow.
pub fn get_tasks_mut(&mut self) -> &Vec<Task> {
&self.tasks
pub fn get_tasks_mut(&mut self) -> &mut Vec<Task> {
&mut self.tasks
}
/// Returns a reference to the steps of the workflow.
pub fn get_workflow(&self) -> &Vec<Edge> {
Expand Down
42 changes: 31 additions & 11 deletions tests/test_workflows/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
"id": "A",
"name": "Web Search Query",
"description": "Write a web search query to collect useful information for the given question",
"messages": [{"role": "user", "content":"You are tasked with generating a single search query to gather useful information for answering a given question. Your goal is to create a concise, clear, and creative query that avoids repeating previously asked questions.\n\nHere is the query you need to address:\n<query>\n{{query}}\n</query>\n\nHere are the previous questions that have been asked:\n<history>\n{{history}}\n</history>\n\nWhen creating your search query, follow these guidelines:\n1. Analyze the given query and identify key concepts or terms.\n2. Review the previous questions to avoid repetition.\n3. Be creative in your approach, considering alternative phrasings or related concepts.\n4. Keep the query concise and clear, typically no more than 5-7 words.\n5. Focus on gathering information that will be most useful in answering the original query.\n\nProvide your search query inside <search_query> tags. Do not include any explanation or additional text outside these tags."}],
"messages": [
{
"role": "user",
"content": "You are tasked with generating a single search query to gather useful information for answering a given question. Your goal is to create a concise, clear, and creative query that avoids repeating previously asked questions.\n\nHere is the query you need to address:\n<query>\n{{query}}\n</query>\n\nHere are the previous questions that have been asked:\n<history>\n{{history}}\n</history>\n\nWhen creating your search query, follow these guidelines:\n1. Analyze the given query and identify key concepts or terms.\n2. Review the previous questions to avoid repetition.\n3. Be creative in your approach, considering alternative phrasings or related concepts.\n4. Keep the query concise and clear, typically no more than 5-7 words.\n5. Focus on gathering information that will be most useful in answering the original query.\n\nProvide your search query inside <search_query> tags. Do not include any explanation or additional text outside these tags."
}
],
"inputs": [
{
"name": "query",
Expand Down Expand Up @@ -48,7 +53,7 @@
"id": "B",
"name": "Web Search",
"description": "Search the web with the given query",
"messages": [{"role": "user", "content": "{query}"}],
"messages": [{ "role": "user", "content": "{query}" }],
"inputs": [
{
"name": "query",
Expand Down Expand Up @@ -77,7 +82,12 @@
"id": "C",
"name": "Candidate Website",
"description": "Pick the most useful link from web search results for the given query",
"messages": [{"role": "user", "content":"Pick the most useful URL to scrape information for Query: {query} \n\n ###Sarch Results:{web_results} \n\n Only output the selected URL: ###Selected URL:"}],
"messages": [
{
"role": "user",
"content": "Pick the most useful URL to scrape information for Query: {query} \n\n ###Sarch Results:{web_results} \n\n Only output the selected URL: ###Selected URL:"
}
],
"inputs": [
{
"name": "web_results",
Expand Down Expand Up @@ -109,7 +119,7 @@
"id": "D",
"name": "Scrape Website",
"description": "Scrape the selected website",
"messages": [{"role": "user", "content":"scrape {search_url}"}],
"messages": [{ "role": "user", "content": "scrape {search_url}" }],
"inputs": [
{
"name": "search_url",
Expand All @@ -134,7 +144,12 @@
"id": "E",
"name": "Summarize Website",
"description": "Summarize website content",
"messages": [{"role": "user", "content":"Answer given question completely based on following context. Don't assume anything. Use the provided information to answer the question. If context is not enough, say 'I dont know.' ###Content: {content} \n\n ###Question: {query} \n\n ###Answer:"}],
"messages": [
{
"role": "user",
"content": "Answer given question completely based on following context. Don't assume anything. Use the provided information to answer the question. If context is not enough, say 'I dont know.' ###Content: {content} \n\n ###Question: {query} \n\n ###Answer:"
}
],
"inputs": [
{
"name": "content",
Expand Down Expand Up @@ -167,7 +182,12 @@
"id": "F",
"name": "Evaluate Result",
"description": "Evaluate if the result is satisfying",
"messages": [{"role": "user", "content":"Evaluate the result if it answers the query. Write 'Yes' if valid, if not 'No'.Write nothing else but strictly 'Yes'|'No'. query:{query} result:{answer}. ###Evaluation:"}],
"messages": [
{
"role": "user",
"content": "Evaluate the result if it answers the query. Write 'Yes' if valid, if not 'No'.Write nothing else but strictly 'Yes'|'No'. query:{query} result:{answer}. ###Evaluation:"
}
],
"inputs": [
{
"name": "answer",
Expand Down Expand Up @@ -199,7 +219,7 @@
"id": "__end",
"name": "end",
"description": "End of the task",
"messages": [{"role": "user", "content": "End of the task"}],
"messages": [{ "role": "user", "content": "End of the task" }],
"inputs": [],
"operator": "end",
"outputs": []
Expand Down Expand Up @@ -233,14 +253,14 @@
"source": "F",
"target": "end",
"condition": {
"input":{
"type":"read",
"key": "final_result"
"input": {
"type": "read",
"key": "final_result"
},
"expression": "Equal",
"expected": "Yes",
"target_if_not": "A"
}
}
}
],
"return_value": {
Expand Down

0 comments on commit 04c6f76

Please sign in to comment.