Skip to content

Instantly share code, notes, and snippets.

@CodeWithOz
Last active August 26, 2025 22:34
Show Gist options
  • Select an option

  • Save CodeWithOz/0b01d558adac703673aceca48471dca7 to your computer and use it in GitHub Desktop.

Select an option

Save CodeWithOz/0b01d558adac703673aceca48471dca7 to your computer and use it in GitHub Desktop.
Agent for cleaning up named entities in YouTube video transcripts.
...
class AgentState(TypedDict):
...
replacement_loop_idx: Annotated[int, operator.add]
...
class DemoEnrichmentAgent:
...
def continue_replacement_router(self, state: AgentState):
replacement_loop_idx = state.get("replacement_loop_idx", 0)
if replacement_loop_idx < len(state.get("verified_entities", [])):
print(f"Replacement ongoing for entity at index {replacement_loop_idx}")
return "continue"
print(f"Replacement complete for all entities")
return "end"
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment