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 DemoEnrichmentAgent:
...
def __init__(self):
...
graph_builder.add_node("replace_entity", self.replace_entity_node)
graph_builder.add_node("replacement_reviewer", self.replacement_reviewer_node)
# set edges
...
graph_builder.add_edge("get_verified_entity_worker", "replacement_reviewer")
graph_builder.add_conditional_edges(
"replacement_reviewer",
self.continue_replacement_router,
{"continue": "replace_entity", "end": END},
)
graph_builder.add_edge("replace_entity", "replacement_reviewer")
...
async def replace_entity_node(self, state: AgentState):
# 🤖 - I will replace the entities in the text
pass
async def replacement_reviewer_node(self, state: AgentState):
# 🤖 - I will review the replacements for completeness
pass
def continue_replacement_router(self, state: AgentState):
# 🔄 - I will decide if the loop should continue or stop
pass
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment