Closed jhakulin closed 2 weeks ago
Hi @jhakulin , it is by design for chat flow that return generator type. You can get the string output like this example
flow_path = "." # Chat flow is in the same folder with this sample
flow_inputs = {
"chat_history": [],
"question": "tell me a joke"
}
flow_result = pf.test(flow=flow_path, inputs=flow_inputs)
answer_result = ""
for item in flow_result["answer"]:
answer_result += item
print(f"Flow outputs: {answer_result}")
In this section, it shows that how to handle the generator type of outputs. https://microsoft.github.io/promptflow/how-to-guides/init-and-test-a-flow.html#test-with-interactive-mode
Hi, we're sending this friendly reminder because we haven't heard back from you in 30 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 7 days of this comment, the issue will be automatically closed. Thank you!
Describe the bug
Following error happens when testing basic chat flow using PromptFlow SDK
2024-04-08 15:00:20 -0700 7692 execution.flow WARNING Failed to serialize inputs or output for flow run because of cannot pickle 'generator' object.The inputs and output field in api_calls will be None. Flow outputs: {'answer': <generator object generate_from_proxy at 0x0000027CB11D7580>}
How To Reproduce the bug Steps to reproduce the behavior, how frequent can you experience the bug:
pf flow init --flow firstchat --type chat
PFClient can help manage your runs and connections.
pf = PFClient()
try: conn_name = "aoai_assistant_connection" conn = pf.connections.get(name=conn_name) print("using existing connection")
except: connection = AzureOpenAIConnection( name=conn_name, api_key="",
api_base="",
api_type="azure",
api_version="",
)
flow_path = "." # Chat flow is in the same folder with this sample
flow_inputs = { "chat_history": [], "question": "tell me a joke" }
flow_result = pf.test(flow=flow_path, inputs=flow_inputs) print(f"Flow outputs: {flow_result}")