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
49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
"""Test script for the promptflow-copilot MAF workflow."""
|
|
|
|
import asyncio
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
from workflow import ChatInput, create_workflow # noqa: E402
|
|
|
|
|
|
async def test_relevant_question():
|
|
print("--- relevant question ---")
|
|
workflow = create_workflow()
|
|
result = await workflow.run(ChatInput(question="How do I deploy a flow?"))
|
|
print("Answer:", result.get_outputs()[0])
|
|
|
|
|
|
async def test_irrelevant_question():
|
|
print("\n--- irrelevant question ---")
|
|
workflow = create_workflow()
|
|
result = await workflow.run(ChatInput(question="What is the weather today?"))
|
|
print("Answer:", result.get_outputs()[0])
|
|
|
|
|
|
async def test_multi_turn():
|
|
print("\n--- multi turn ---")
|
|
history = [
|
|
{
|
|
"inputs": {"question": "What is promptflow?"},
|
|
"outputs": {
|
|
"output": "Prompt flow is a suite of dev tools for LLM apps."
|
|
},
|
|
},
|
|
]
|
|
workflow = create_workflow()
|
|
result = await workflow.run(ChatInput(question="How do I create a flow?", chat_history=history))
|
|
print("Answer:", result.get_outputs()[0])
|
|
|
|
|
|
async def main():
|
|
await test_relevant_question()
|
|
await test_irrelevant_question()
|
|
await test_multi_turn()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|