File size: 851 Bytes
b6ed6f7 0aa8e87 b6ed6f7 0aa8e87 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from src.agents.CallState import CallState
class Router:
def __call__(self, state: CallState) -> str:
"""Invokes above agents accordingly."""
if state.get("metadata", {}).get("intake_error"):
return "end"
file_type = state["file_type"]
if file_type in ["mp3", "wav"] and not state.get("content"):
return "transcribe"
return "summarize"
class PostSummarizeRouter:
def __call__(self, state: CallState) -> str:
"""Routes based on model output quality."""
if state.get("metadata", {}).get("intake_error"):
return "end"
text = state.get("clean_content") or state.get("content") or ""
if len(text.strip()) < 40:
return "end"
if not (state.get("summary") or "").strip():
return "end"
return "score"
|