From 5ddf3c77051d245723506466c6b0085fe04bb275 Mon Sep 17 00:00:00 2001 From: Steve Androulakis Date: Thu, 2 Jan 2025 09:27:32 -0800 Subject: [PATCH] workflow rename, prompt tuning --- prompts/agent_prompt_generators.py | 10 +++++++++- scripts/end_chat.py | 2 +- scripts/get_history.py | 2 +- scripts/run_worker.py | 2 +- scripts/send_message.py | 4 ++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/prompts/agent_prompt_generators.py b/prompts/agent_prompt_generators.py index 7585e43..70c1a6a 100644 --- a/prompts/agent_prompt_generators.py +++ b/prompts/agent_prompt_generators.py @@ -69,7 +69,9 @@ def generate_genai_prompt_from_tools_data( "7. Keep responses in plain text. Return valid JSON without extra commentary." ) prompt_lines.append("") - prompt_lines.append("Begin by prompting or confirming the necessary details.") + prompt_lines.append( + "Begin by prompting or confirming the necessary details. If any are missing (null) ensure you ask for them." + ) return "\n".join(prompt_lines) @@ -126,6 +128,12 @@ def generate_json_validation_prompt_from_tools_data( "5. 'next' should be one of 'question', 'confirm', or 'done' (if no more actions)." "Do NOT use 'next': 'confirm' until you have all args. If there are any args that are null then next='question'). " ) + prompt_lines.append( + "6. If any of args is 'null' then ensure next = 'question' and that your response asks for this information from the user. " + ) + prompt_lines.append( + "7. If all tools mentioned above have 'completed successfully' (check the history) then next should be 'done'. " + ) prompt_lines.append( "Use the conversation history to parse known data for filling 'args' if possible. " ) diff --git a/scripts/end_chat.py b/scripts/end_chat.py index 8913f16..ee4381e 100644 --- a/scripts/end_chat.py +++ b/scripts/end_chat.py @@ -8,7 +8,7 @@ async def main(): # Create client connected to server at the given address client = await Client.connect("localhost:7233") - workflow_id = "ollama-agent" + workflow_id = "agent-workflow" handle = client.get_workflow_handle_for(ToolWorkflow.run, workflow_id) diff --git a/scripts/get_history.py b/scripts/get_history.py index a09a868..97fdf8c 100644 --- a/scripts/get_history.py +++ b/scripts/get_history.py @@ -7,7 +7,7 @@ from workflows import ToolWorkflow async def main(): # Create client connected to server at the given address client = await Client.connect("localhost:7233") - workflow_id = "ollama-agent" + workflow_id = "agent-workflow" handle = client.get_workflow_handle(workflow_id) diff --git a/scripts/run_worker.py b/scripts/run_worker.py index cdd11b8..7213f9c 100644 --- a/scripts/run_worker.py +++ b/scripts/run_worker.py @@ -18,7 +18,7 @@ async def main(): with concurrent.futures.ThreadPoolExecutor(max_workers=100) as activity_executor: worker = Worker( client, - task_queue="ollama-task-queue", + task_queue="agent-task-queue", workflows=[ToolWorkflow], activities=[ activities.prompt_llm, diff --git a/scripts/send_message.py b/scripts/send_message.py index baaf8e9..154b162 100644 --- a/scripts/send_message.py +++ b/scripts/send_message.py @@ -91,7 +91,7 @@ async def main(prompt: str): # 4) Connect to Temporal and start or signal the workflow client = await Client.connect("localhost:7233") - workflow_id = "ollama-agent" + workflow_id = "agent-workflow" # Note that we start the ToolWorkflow.run with 'combined_input' # Then we immediately signal with the initial prompt @@ -99,7 +99,7 @@ async def main(prompt: str): ToolWorkflow.run, combined_input, id=workflow_id, - task_queue="ollama-task-queue", + task_queue="agent-task-queue", start_signal="user_prompt", # This will send your first prompt to the workflow start_signal_args=[prompt], )