Schemas
List of common schemas.
Chatbot
A chatbot is represented by a back-and-forth conversation between a user and an assistant.
class ChatbotInput(BaseModel):
user_message: str
class ChatbotOutput(BaseModel):
assistant_message: strPII Extraction
PII extraction is the process of identifying and extracting specific entities from a text.
class PIIType(str, Enum):
"""Categories of Personal Identifiable Information."""
NAME = "NAME" # Full names, first names, last names
EMAIL = "EMAIL" # Email addresses
PHONE = "PHONE" # Phone numbers, fax numbers
ADDRESS = "ADDRESS" # Physical addresses, postal codes
SSN = "SSN" # Social Security Numbers, National IDs
DOB = "DOB" # Date of birth, age
FINANCIAL = "FINANCIAL" # Credit card numbers, bank accounts
LICENSE = "LICENSE" # Driver's license, professional licenses
URL = "URL" # Personal URLs, social media profiles
OTHER = "OTHER" # Other types of PII not covered above
class PIIExtraction(BaseModel):
"""Represents an extracted piece of PII with its type."""
text: str = Field(description="The extracted PII text")
type: PIIType = Field(description="The category of PII")
start_index: int = Field(description="Starting position in the original text")
end_index: int = Field(description="Ending position in the original text")
class PIIInput(BaseModel):
"""Input model for PII extraction."""
text: str = Field(description="The text to analyze for PII")
class PIIOutput(BaseModel):
"""Output model containing redacted text and extracted PII."""
redacted_text: str = Field(
description="The original text with all PII replaced by [REDACTED]",
examples=[
"Hi, I'm [REDACTED]. You can reach me at [REDACTED] or call [REDACTED]. "
"My SSN is [REDACTED] and I live at [REDACTED].",
],
)
extracted_pii: list[PIIExtraction] = Field(
description="List of extracted PII items with their types and positions",
examples=[
[
{"text": "John Doe", "type": "NAME", "start_index": 8, "end_index": 16},
{"text": "[email protected]", "type": "EMAIL", "start_index": 30, "end_index": 47},
{"text": "555-0123", "type": "PHONE", "start_index": 57, "end_index": 65},
],
],
)Extract positive and negative points from transcript
Image
Audio
Last updated