Replace getattr() calls with direct attribute access and isinstance() checks on the strongly-typed OpenAI SDK event models.