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.
...
from pydantic import BaseModel, Field
class NamedEntity(BaseModel):
entity_name: str = Field(description="A short name for the entity.")
entity_context: str = Field(
description="A **brief** phrase (≤ 12 words) that is suitable for web search."
)
class NamedEntities(BaseModel):
named_entities: list[NamedEntity]
...
class DemoEnrichmentAgent:
extractor_llm: Runnable
def __init__(self):
self.extractor_llm = init_chat_model(
"gpt-4o-mini",
model_provider="openai"
).with_structured_output(NamedEntities)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment