Skip to content

Commit fe1165b

Browse files
author
Min Shi
committed
add random fail node to web_classification_random_fail
1 parent f6bf913 commit fe1165b

6 files changed

Lines changed: 46 additions & 4 deletions

File tree

‎src/promptflow-recording/recordings/local/node_cache.shelve.bak‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,16 @@
6464
'168786c62c341d79c15261a538bca1c22826b988', (263168, 4250)
6565
'f41378cf209103949aa13c85b2708f16611dfe2f', (267776, 4962)
6666
'22099320490973d1d4de67b18bec3ffa8b1a64e3', (272896, 11361)
67+
'94217ac2bde6b4d503c6cf2cb6b6684f2558e17b', (284672, 1816)
68+
'ca0f85c909d3c829ff7cdc311f1126b5faa7b620', (286720, 2183)
69+
'830da0662a3a0a2ce6bbefaf32f20d1cce71eaee', (289280, 2218)
70+
'2c6fd767d0af636ff7f00c695352884c7777346f', (291840, 420)
71+
'4e5d06c5c748666c92857c06dac9752580176040', (292352, 5117)
72+
'37923670ba0a1fb49fd818ce3164f6d0114ed365', (297472, 5098)
73+
'ae2dc6373e8a85037e626cc8138a56ff39962eb6', (302592, 2696)
74+
'd12d1df0c8c074567590a26cf6969ef2230eefb3', (305664, 5191)
75+
'5d9aad10c1f95071820bba6477ded5b1d61b8cc9', (311296, 5212)
76+
'fe8f1369c9f9a092a92e77139a7c549bb1902656', (316928, 4562)
77+
'002df657dcaf0183d6597c86c2fd5a1726ae7a1f', (321536, 5205)
78+
'c6630441f0cd6b2bb5cce4ecf92bfee9a663e838', (327168, 5179)
79+
'd043076bb13f4539e5e9da8d4bb6b06820cce829', (332800, 5293)
52.6 KB
Binary file not shown.

‎src/promptflow-recording/recordings/local/node_cache.shelve.dir‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,16 @@
6464
'168786c62c341d79c15261a538bca1c22826b988', (263168, 4250)
6565
'f41378cf209103949aa13c85b2708f16611dfe2f', (267776, 4962)
6666
'22099320490973d1d4de67b18bec3ffa8b1a64e3', (272896, 11361)
67+
'94217ac2bde6b4d503c6cf2cb6b6684f2558e17b', (284672, 1816)
68+
'ca0f85c909d3c829ff7cdc311f1126b5faa7b620', (286720, 2183)
69+
'830da0662a3a0a2ce6bbefaf32f20d1cce71eaee', (289280, 2218)
70+
'2c6fd767d0af636ff7f00c695352884c7777346f', (291840, 420)
71+
'4e5d06c5c748666c92857c06dac9752580176040', (292352, 5117)
72+
'37923670ba0a1fb49fd818ce3164f6d0114ed365', (297472, 5098)
73+
'ae2dc6373e8a85037e626cc8138a56ff39962eb6', (302592, 2696)
74+
'd12d1df0c8c074567590a26cf6969ef2230eefb3', (305664, 5191)
75+
'5d9aad10c1f95071820bba6477ded5b1d61b8cc9', (311296, 5212)
76+
'fe8f1369c9f9a092a92e77139a7c549bb1902656', (316928, 4562)
77+
'002df657dcaf0183d6597c86c2fd5a1726ae7a1f', (321536, 5205)
78+
'c6630441f0cd6b2bb5cce4ecf92bfee9a663e838', (327168, 5179)
79+
'd043076bb13f4539e5e9da8d4bb6b06820cce829', (332800, 5293)

‎src/promptflow/tests/test_configs/flows/web_classification_random_fail/fetch_text_content_from_url.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import bs4
22
import requests
3-
import random
43
from promptflow import tool
54

65

76
@tool
87
def fetch_text_content_from_url(url: str):
9-
if random.random() < 0.5:
10-
raise ValueError("Random failure")
118
# Send a request to the URL
129
try:
1310
headers = {

‎src/promptflow/tests/test_configs/flows/web_classification_random_fail/flow.dag.yaml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ nodes:
1616
type: code
1717
path: fetch_text_content_from_url.py
1818
inputs:
19-
url: ${inputs.url}
19+
url: ${random_failure.output}
2020
- name: summarize_text_content
2121
type: llm
2222
source:
@@ -66,3 +66,10 @@ nodes:
6666
path: convert_to_dict.py
6767
inputs:
6868
input_str: ${classify_with_llm.output}
69+
- name: random_failure
70+
type: python
71+
source:
72+
type: code
73+
path: random_failure.py
74+
inputs:
75+
url: ${inputs.url}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import random
2+
from promptflow import tool
3+
4+
5+
# The inputs section will change based on the arguments of the tool function, after you save the code
6+
# Adding type to arguments and return value will help the system show the types properly
7+
# Please update the function name/signature per need
8+
@tool
9+
def random_failure(url: str) -> str:
10+
if random.random() < 0.5:
11+
raise ValueError("Random failure")
12+
return url

0 commit comments

Comments
 (0)