We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 50b4366 commit b44b9b4Copy full SHA for b44b9b4
api/nodes/new_pipeline/business_anchor_guard.py
@@ -1,13 +1,17 @@
1
from api.nodes.fetch_summary_node import Node
2
3
@Node(retries=1)
4
-def BusinessAnchorGuard(prompts: list[str], keyphrases: list[str]) -> list[str]:
+def BusinessAnchorGuard(prompts, keyphrases: list[str]):
5
"""
6
Keep prompts that mention at least one scraped key-phrase.
7
If no key-phrases were extracted, return an empty list.
8
9
if not keyphrases:
10
- return []
+ # 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()}
15
16
lowered_phrases = [kp.lower() for kp in keyphrases]
17
anchored = [
0 commit comments