Skip to content

Commit b44b9b4

Browse files
committed
fix(business-anchor): do not filter prompts when no keyphrases present
1 parent 50b4366 commit b44b9b4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

api/nodes/new_pipeline/business_anchor_guard.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
from api.nodes.fetch_summary_node import Node
22

33
@Node(retries=1)
4-
def BusinessAnchorGuard(prompts: list[str], keyphrases: list[str]) -> list[str]:
4+
def BusinessAnchorGuard(prompts, keyphrases: list[str]):
55
"""
66
Keep prompts that mention at least one scraped key-phrase.
77
If no key-phrases were extracted, return an empty list.
88
"""
99
if not keyphrases:
10-
return []
10+
# No keyphrases: do not filter; return original prompts
11+
return prompts
12+
# If grouped dict, apply per category
13+
if isinstance(prompts, dict):
14+
return {cat: BusinessAnchorGuard(items, keyphrases) for cat, items in prompts.items()}
1115

1216
lowered_phrases = [kp.lower() for kp in keyphrases]
1317
anchored = [

0 commit comments

Comments
 (0)