Skip to content

Commit 57a1cf8

Browse files
committed
prompt flow troubleshoot ai studio
1 parent 9f84301 commit 57a1cf8

File tree

2 files changed

+190
-0
lines changed

2 files changed

+190
-0
lines changed
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
---
2+
title: Troubleshoot guidance for prompt flow
3+
titleSuffix: Azure AI Studio
4+
description: This article addresses frequent questions about prompt flow usage.
5+
manager: scottpolly
6+
ms.service: azure-ai-studio
7+
ms.topic: reference
8+
author: lgayhardt
9+
ms.author: lagayhar
10+
ms.reviewer: chenjieting
11+
ms.date: 07/17/2024
12+
---
13+
14+
# Troubleshoot guidance for prompt flow
15+
16+
This article addresses frequent questions about prompt flow usage.
17+
18+
## Compute session related issues
19+
20+
### Run failed because of "No module named XXX"
21+
22+
This type of error related to compute session lacks required packages. If you're using a default environment, make sure the image of your compute session is using the latest version. If you're using a custom base image, make sure you installed all the required packages in your docker context.
23+
24+
### Where to find the serverless instance used by compute session?
25+
26+
You can view the serverless instance used by compute session in the compute session list tab under compute page. Learn more about [how to manage serverless instance](./how-to-manage-compute-session.md#manage-serverless-instance-used-by-compute-session).
27+
28+
### Compute session failures using custom base image
29+
30+
#### Compute session start failure with requirements.txt or custom base image
31+
32+
Compute session support to use `requirements.txt` or custom base image in `flow.dag.yaml` to customize the image. We would recommend you to use `requirements.txt` for common case, which will use `pip install -r requirements.txt` to install the packages. If you have dependency more than python packages, you need to follow the [Customize base image](./how-to-customize-session-base-image.md) to create build a new image base on top of prompt flow base image. Then use it in `flow.dag.yaml`. Learn more [how to specify base image in compute session.](./how-to-manage-compute-session.md#change-the-base-image-for-compute-session)
33+
34+
- You can't use arbitrary base image to create Compute session, you need to use the base image provide by prompt flow.
35+
- Don't pin the version of `promptflow` and `promptflow-tools` in `requirements.txt`, because we already include them in the base image. Using old version of `promptflow` and `promptflow-tools` may cause unexpected behavior.
36+
37+
## Flow run related issues
38+
39+
### How to find the raw inputs and outputs of in LLM tool for further investigation?
40+
41+
In prompt flow, on flow page with successful run and run detail page, you can find the raw inputs and outputs of LLM tool in the output section. Select the `view full output` button to view full output.
42+
43+
:::image type="content" source="./media/prompt-flow/view-full-output.png" alt-text="Screenshot that shows view full output on LLM node." lightbox = "./media/prompt-flow/view-full-output.png":::
44+
45+
`Trace` section includes each request and response to the LLM tool. You can check the raw message sent to the LLM model and the raw response from the LLM model.
46+
47+
:::image type="content" source="./media/faq/trace-large-language-model-tool.png" alt-text="Screenshot that shows raw request send to LLM model and response from LLM model." lightbox = "./media/faq/trace-large-language-model-tool.png":::
48+
49+
### How to fix 409 error from Azure OpenAI?
50+
51+
You may encounter 409 error from Azure OpenAI, it means you have reached the rate limit of Azure OpenAI. You can check the error message in the output section of LLM node. Learn more about [Azure OpenAI rate limit](../../ai-services/openai/quotas-limits.md).
52+
53+
:::image type="content" source="./media/faq/429-rate-limit.png" alt-text="Screenshot that shows 429 rate limit error from Azure OpenAI." lightbox = "./media/faq/429-rate-limit.png":::
54+
55+
### Identify which node consumes the most time
56+
57+
1. Check the compute session logs.
58+
59+
1. Try to find the following warning log format:
60+
61+
{node_name} has been running for {duration} seconds.
62+
63+
For example:
64+
65+
- **Case 1:** Python script node runs for a long time.
66+
67+
:::image type="content" source="./media/how-to-create-manage-runtime/runtime-timeout-running-for-long-time.png" alt-text="Screenshot that shows a timeout run sign in the studio UI." lightbox = "./media/how-to-create-manage-runtime/runtime-timeout-running-for-long-time.png":::
68+
69+
In this case, you can find that `PythonScriptNode` was running for a long time (almost 300 seconds). Then you can check the node details to see what's the problem.
70+
71+
- **Case 2:** LLM node runs for a long time.
72+
73+
:::image type="content" source="./media/how-to-create-manage-runtime/runtime-timeout-by-language-model-timeout.png" alt-text="Screenshot that shows timeout logs caused by an LLM timeout in the studio UI." lightbox = "./media/how-to-create-manage-runtime/runtime-timeout-by-language-model-timeout.png":::
74+
75+
In this case, if you find the message `request canceled` in the logs, it might be because the OpenAI API call is taking too long and exceeding the timeout limit.
76+
77+
An OpenAI API timeout could be caused by a network issue or a complex request that requires more processing time. For more information, see [OpenAI API timeout](https://help.openai.com/en/articles/6897186-timeout).
78+
79+
Wait a few seconds and retry your request. This action usually resolves any network issues.
80+
81+
If retrying doesn't work, check whether you're using a long context model, such as `gpt-4-32k`, and have set a large value for `max_tokens`. If so, the behavior is expected because your prompt might generate a long response that takes longer than the interactive mode's upper threshold. In this situation, we recommend trying `Bulk test` because this mode doesn't have a timeout setting.
82+
83+
1. If you can't find anything in logs to indicate it's a specific node issue:
84+
85+
- Contact the prompt flow team ([promptflow-eng](mailto:[email protected])) with the logs. We try to identify the root cause.
86+
87+
## Flow deployment related issues
88+
89+
### Upstream request timeout issue when consuming the endpoint
90+
91+
If you use CLI or SDK to deploy the flow, you may encounter timeout error. By default the `request_timeout_ms` is 5000. You can specify at max to 5 minutes, which is 300,000 ms. Following is example showing how to specify request time-out in the deployment yaml file. To learn more, see [deployment schema](../reference-yaml-deployment-managed-online.md).
92+
93+
```yaml
94+
request_settings:
95+
request_timeout_ms: 300000
96+
```
97+
98+
### OpenAI API hits authentication error
99+
100+
If you regenerate your Azure OpenAI key and manually update the connection used in prompt flow, you may encounter errors like "Unauthorized. Access token is missing, invalid, audience is incorrect or have expired." when invoking an existing endpoint created before key regenerating.
101+
102+
This is because the connections used in the endpoints/deployments won't be automatically updated. Any change for key or secrets in deployments should be done by manual update, which aims to avoid impacting online production deployment due to unintentional offline operation.
103+
104+
- If the endpoint was deployed in the studio UI, you can just redeploy the flow to the existing endpoint using the same deployment name.
105+
- If the endpoint was deployed using SDK or CLI, you need to make some modification to the deployment definition such as adding a dummy environment variable, and then use `az ml online-deployment update` to update your deployment.
106+
107+
### Vulnerability issues in prompt flow deployments
108+
109+
For prompt flow runtime related vulnerabilities, following are approaches, which can help mitigate:
110+
111+
- Update the dependency packages in your requirements.txt in your flow folder.
112+
- If you're using customized base image for your flow, you need to update the prompt flow runtime to latest version and rebuild your base image, then redeploy the flow.
113+
114+
For any other vulnerabilities of managed online deployments, Azure AI fixes the issues in a monthly manner.
115+
116+
### "MissingDriverProgram Error" or "Could not find driver program in the request"
117+
118+
If you deploy your flow and encounter the following error, it might be related to the deployment environment.
119+
120+
```text
121+
'error':
122+
{
123+
'code': 'BadRequest',
124+
'message': 'The request is invalid.',
125+
'details':
126+
{'code': 'MissingDriverProgram',
127+
'message': 'Could not find driver program in the request.',
128+
'details': [],
129+
'additionalInfo': []
130+
}
131+
}
132+
```
133+
134+
```text
135+
Could not find driver program in the request
136+
```
137+
138+
There are two ways to fix this error.
139+
140+
- (Recommended) You can find the container image uri in your custom environment detail page, and set it as the flow base image in the flow.dag.yaml file. When you deploy the flow in UI, you just select **Use environment of current flow definition**, and the backend service will create the customized environment based on this base image and `requirement.txt` for your deployment. Learn more about [the environment specified in the flow definition](how-to-deploy-for-real-time-inference.md#use-environment-of-current-flow-definition).
141+
142+
:::image type="content" source="./media/how-to-deploy-for-real-time-inference/custom-environment-image-uri.png" alt-text="Screenshot of custom environment detail page. " lightbox = "./media/how-to-deploy-for-real-time-inference/custom-environment-image-uri.png":::
143+
144+
:::image type="content" source="./media/how-to-deploy-for-real-time-inference/flow-environment-image.png" alt-text="Screenshot of specifying base image in raw yaml file of the flow. " lightbox = "./media/how-to-deploy-for-real-time-inference/flow-environment-image.png":::
145+
146+
- You can fix this error by adding `inference_config` in your custom environment definition.
147+
148+
Following is an example of customized environment definition.
149+
150+
```yaml
151+
$schema: https://azuremlschemas.azureedge.net/latest/environment.schema.json
152+
name: pf-customized-test
153+
build:
154+
path: ./image_build
155+
dockerfile_path: Dockerfile
156+
description: promptflow customized runtime
157+
inference_config:
158+
liveness_route:
159+
port: 8080
160+
path: /health
161+
readiness_route:
162+
port: 8080
163+
path: /health
164+
scoring_route:
165+
port: 8080
166+
path: /score
167+
```
168+
169+
### Model response taking too long
170+
171+
Sometimes, you might notice that the deployment is taking too long to respond. There are several potential factors for this to occur.
172+
173+
- The model used in the flow isn't powerful enough (example: use GPT 3.5 instead of text-ada)
174+
- Index query isn't optimized and taking too long
175+
- Flow has many steps to process
176+
177+
Consider optimizing the endpoint with above considerations to improve the performance of the model.
178+
179+
### Unable to fetch deployment schema
180+
181+
After you deploy the endpoint and want to test it in the **Test tab** in the endpoint detail page, if the **Test tab** shows **Unable to fetch deployment schema**, you can try the following two methods to mitigate this issue:
182+
183+
:::image type="content" source="./media/how-to-deploy-for-real-time-inference/unable-to-fetch-deployment-schema.png" alt-text="Screenshot of the error unable to fetch deployment schema in Test tab in endpoint detail page. " lightbox = "./media/how-to-deploy-for-real-time-inference/unable-to-fetch-deployment-schema.png":::
184+
185+
- Make sure you have granted the correct permission to the endpoint identity. Learn more about [how to grant permission to the endpoint identity](how-to-deploy-for-real-time-inference.md#grant-permissions-to-the-endpoint).
186+
- It might be because you ran your flow in an old version runtime and then deployed the flow, the deployment used the environment of the runtime that was in old version as well. To update the runtime, follow [Update a runtime on the UI](./create-manage-runtime.md#update-a-runtime-on-the-ui) and rerun the flow in the latest runtime and then deploy the flow again.
187+
188+
### Access denied to list workspace secret
189+
190+
If you encounter an error like "Access denied to list workspace secret", check whether you have granted the correct permission to the endpoint identity. Learn more about [how to grant permission to the endpoint identity](flow-deploy.md?tabs=azure-studio#grant-permissions-to-the-endpoint).
108 KB
Loading

0 commit comments

Comments
 (0)