mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-17 06:58:09 +01:00
workflow rename, prompt tuning
This commit is contained in:
@@ -69,7 +69,9 @@ def generate_genai_prompt_from_tools_data(
|
|||||||
"7. Keep responses in plain text. Return valid JSON without extra commentary."
|
"7. Keep responses in plain text. Return valid JSON without extra commentary."
|
||||||
)
|
)
|
||||||
prompt_lines.append("")
|
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)
|
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)."
|
"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'). "
|
"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(
|
prompt_lines.append(
|
||||||
"Use the conversation history to parse known data for filling 'args' if possible. "
|
"Use the conversation history to parse known data for filling 'args' if possible. "
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ async def main():
|
|||||||
# Create client connected to server at the given address
|
# Create client connected to server at the given address
|
||||||
client = await Client.connect("localhost:7233")
|
client = await Client.connect("localhost:7233")
|
||||||
|
|
||||||
workflow_id = "ollama-agent"
|
workflow_id = "agent-workflow"
|
||||||
|
|
||||||
handle = client.get_workflow_handle_for(ToolWorkflow.run, workflow_id)
|
handle = client.get_workflow_handle_for(ToolWorkflow.run, workflow_id)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from workflows import ToolWorkflow
|
|||||||
async def main():
|
async def main():
|
||||||
# Create client connected to server at the given address
|
# Create client connected to server at the given address
|
||||||
client = await Client.connect("localhost:7233")
|
client = await Client.connect("localhost:7233")
|
||||||
workflow_id = "ollama-agent"
|
workflow_id = "agent-workflow"
|
||||||
|
|
||||||
handle = client.get_workflow_handle(workflow_id)
|
handle = client.get_workflow_handle(workflow_id)
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ async def main():
|
|||||||
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as activity_executor:
|
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as activity_executor:
|
||||||
worker = Worker(
|
worker = Worker(
|
||||||
client,
|
client,
|
||||||
task_queue="ollama-task-queue",
|
task_queue="agent-task-queue",
|
||||||
workflows=[ToolWorkflow],
|
workflows=[ToolWorkflow],
|
||||||
activities=[
|
activities=[
|
||||||
activities.prompt_llm,
|
activities.prompt_llm,
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ async def main(prompt: str):
|
|||||||
# 4) Connect to Temporal and start or signal the workflow
|
# 4) Connect to Temporal and start or signal the workflow
|
||||||
client = await Client.connect("localhost:7233")
|
client = await Client.connect("localhost:7233")
|
||||||
|
|
||||||
workflow_id = "ollama-agent"
|
workflow_id = "agent-workflow"
|
||||||
|
|
||||||
# Note that we start the ToolWorkflow.run with 'combined_input'
|
# Note that we start the ToolWorkflow.run with 'combined_input'
|
||||||
# Then we immediately signal with the initial prompt
|
# Then we immediately signal with the initial prompt
|
||||||
@@ -99,7 +99,7 @@ async def main(prompt: str):
|
|||||||
ToolWorkflow.run,
|
ToolWorkflow.run,
|
||||||
combined_input,
|
combined_input,
|
||||||
id=workflow_id,
|
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="user_prompt", # This will send your first prompt to the workflow
|
||||||
start_signal_args=[prompt],
|
start_signal_args=[prompt],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user