e768098d0e
tools_continuous_delivery / Private PyPI non-main branch release (push) Has been skipped
tools_continuous_delivery / Private PyPI main branch release (push) Failing after 2m42s
Publish Promptflow Doc / Build (push) Has been cancelled
Publish Promptflow Doc / Deploy (push) Has been cancelled
Flake8 Lint / flake8 (push) Has been cancelled
Spell check CI / Spell_Check (push) Has been cancelled
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
import asyncio
|
|
from workflow import create_workflow
|
|
|
|
|
|
async def main():
|
|
"""Run the workflow with multiple inputs to demonstrate random conditions."""
|
|
|
|
test_questions = [
|
|
"What is Prompt flow?",
|
|
"How does it work?",
|
|
"Tell me more about the features",
|
|
"What is machine learning?",
|
|
]
|
|
|
|
print("=" * 70)
|
|
print("Testing Conditional Workflow with Random Conditions")
|
|
print("=" * 70)
|
|
print()
|
|
|
|
safe_count = 0
|
|
unsafe_count = 0
|
|
|
|
for i, question in enumerate(test_questions, 1):
|
|
workflow = create_workflow()
|
|
result = await workflow.run(question)
|
|
output = result.get_outputs()[0]
|
|
|
|
# Determine which path was taken based on the output
|
|
is_safe_path = "Prompt flow is a suite" in output
|
|
|
|
if is_safe_path:
|
|
safe_count += 1
|
|
status = "✓ SAFE"
|
|
else:
|
|
unsafe_count += 1
|
|
status = "✗ UNSAFE"
|
|
|
|
print(f"Test {i:2d} [{status}]: {question}")
|
|
print(f" → {output}")
|
|
print()
|
|
|
|
print("=" * 70)
|
|
print("Results Summary:")
|
|
print(f" Safe paths: {safe_count}/{len(test_questions)}")
|
|
print(f" Unsafe paths: {unsafe_count}/{len(test_questions)}")
|
|
print("=" * 70)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|