You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble when switching starting my flow using the Promptflow SDK from flow-as-a-function to PFClient.run()
I want to start using the PFClient because it allows for logging the system metrics such as the prompt_tokens and completions_tokens.
I initialize my Application insights through this code
And in the instance of flow-as-a-function I run the flow like this
flow='path/to/flow/folder'f=load_flow(flow)
utterance=request.message.contenttry:
ifcontains_json_html_structure(utterance):
raiseValueError("Utterance contains json/html-like values") # noqa: E501# post the request and get the resultresult=f(
webhook_input=request.webhook_input,
session_id=completion_input.context.message.session_id,
role=completion_input.context.message.role,
# Filter JSON elements out of utteranceutterance=utterance,
)
result=result["output"]
# Log results for application insightslogger.info(json.dumps(result))
exceptExceptionase:
<....>
In this case all my logs both in python code in the flow as well as after get neatly uploaded to Application Insights
If I replace the flow-as-a-function with a PFClient.run() like so:
Then the logs stop as soon as the line run = pf.run(... starts. What also changes in the output in terminal is the following additions:
Multiple instances of trace detail URL being created as such: You can view the trace detail from the following URL: http://127.0.0.1:23336/v1.0/ui/traces/?#collection=src&uiTraceId=0xb0e9328dedd7df8f0e29fe305d371f24 with differing TraceId's
At the beginning and end of a flow this ERROR appears: 2025-01-14 15:30:45 +0100 azure.monitor.opentelemetry.exporter.export._base:_transmit ERROR Non-retryable server side error: Operation returned an invalid status 'Bad Request'.
Package versions for promptflow and telemetry related packages is:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm having trouble when switching starting my flow using the Promptflow SDK from flow-as-a-function to PFClient.run()
I want to start using the PFClient because it allows for logging the system metrics such as the prompt_tokens and completions_tokens.
I initialize my Application insights through this code
And in the instance of flow-as-a-function I run the flow like this
In this case all my logs both in python code in the flow as well as after get neatly uploaded to Application Insights
If I replace the flow-as-a-function with a PFClient.run() like so:
Then the logs stop as soon as the line
run = pf.run(...
starts. What also changes in the output in terminal is the following additions:You can view the trace detail from the following URL: http://127.0.0.1:23336/v1.0/ui/traces/?#collection=src&uiTraceId=0xb0e9328dedd7df8f0e29fe305d371f24
with differing TraceId's2025-01-14 15:30:45 +0100 azure.monitor.opentelemetry.exporter.export._base:_transmit ERROR Non-retryable server side error: Operation returned an invalid status 'Bad Request'.
Package versions for promptflow and telemetry related packages is:
I have tried to configure Application Insights through the flow.dag.yaml as well by adding all combinations of
None of which seem to make a difference.
The flow and surrounding code is started through a call to a fastapi endpoint.
Beta Was this translation helpful? Give feedback.
All reactions