-
Notifications
You must be signed in to change notification settings - Fork 909
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add random fail node to web_classification_random_fail
- Loading branch information
Min Shi
committed
Apr 11, 2024
1 parent
f6bf913
commit 4ee3595
Showing
3 changed files
with
20 additions
and
4 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
...ow/tests/test_configs/flows/web_classification_random_fail/fetch_text_content_from_url.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/promptflow/tests/test_configs/flows/web_classification_random_fail/random_failure.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import random | ||
from promptflow import tool | ||
|
||
|
||
# The inputs section will change based on the arguments of the tool function, after you save the code | ||
# Adding type to arguments and return value will help the system show the types properly | ||
# Please update the function name/signature per need | ||
@tool | ||
def random_failure(url: str) -> str: | ||
if random.random() < 0.5: | ||
raise ValueError("Random failure") | ||
return url |