ChatGPT · AgentsDatos
Request extractor for clothing stores
Turns clothing stores customer messages into structured data.
by Prompt Studio
agents-sdkpythonoutput_type
License: MITView original
Contents
Where it goes: extract_fashion_retail.py
# Extrae datos estructurados de mensajes de clientas y clientes de una tienda de ropa.
# pip install openai-agents pydantic
from typing import Literal
from pydantic import BaseModel
from agents import Agent, Runner
class Solicitud(BaseModel):
tipo: Literal["nueva", "cambio", "cancelación", "queja", "duda"]
nombre_cliente: str | None
fecha: str | None # YYYY-MM-DD si la menciona
detalle: str
urgente: bool
extractor = Agent(
name="Extractor de solicitudes",
instructions=(
"Lee el mensaje de un cliente sobre prendas y llena los campos. "
"Si un dato no aparece, déjalo en null; no lo adivines. "
"Marca urgente si menciona tallas agotadas o un plazo de menos de 24 horas."
),
output_type=Solicitud,
)
mensaje = "Buenas, soy Ana. Necesito mover mi prenda del viernes al lunes 12, es urgente."
solicitud: Solicitud = Runner.run_sync(extractor, mensaje).final_output
print(solicitud.model_dump_json(indent=2))
More in Agents
Support with handoffs
A triage agent that hands off to billing or tech support.
Web researcher
Searches the web, cites sources and writes a short report.
Analyst with guardrails
TypeScript agent with a custom tool and an input guardrail.
Lead qualifier
Researches the lead company and returns a structured score.
Operations assistant for restaurants
Agent with function tools for day-to-day restaurants work.
Triage with handoffs for restaurants
Front-desk agent that hands off customers of restaurants.