Skip to content

ValidationError: EntityType enum missing location_state - API returns unsupported entity type #154

@ksquarekumar

Description

@ksquarekumar

Description

The AssemblyAI API is returning a new entity type location_state that is not included in the SDK's EntityType enum, causing Pydantic validation to fail when parsing the TranscriptResponse.

SDK Version

  • assemblyai: 0.48.x (issue exists in all current versions including 0.48.3)
  • Python: 3.12

Error

pydantic_core._pydantic_core.ValidationError: 1 validation error for TranscriptResponse
entities.17.entity_type
  Input should be 'account_number', 'banking_information', 'blood_type', 'credit_card_cvv',
  'credit_card_expiration', 'credit_card_number', 'date', 'date_interval', 'date_of_birth',
  'drivers_license', 'drug', 'duration', 'email_address', 'event', 'filename', 'gender_sexuality',
  'healthcare_number', 'injury', 'ip_address', 'language', 'location', 'marital_status',
  'medical_condition', 'medical_process', 'money_amount', 'nationality', 'number_sequence',
  'occupation', 'organization', 'passport_number', 'password', 'person_age', 'person_name',
  'phone_number', 'physical_attribute', 'political_affiliation', 'religion', 'statistics',
  'time', 'url', 'us_social_security_number', 'username', 'vehicle_id' or 'zodiac_sign'
  [type=enum, input_value='location_state', input_type=str]

Relevant Stack Trace

  File "assemblyai/transcriber.py", line 89, in wait_for_completion
      self.transcript = api.get_transcript(...)
  File "assemblyai/api.py", line 67, in get_transcript
      return types.TranscriptResponse.parse_obj(response.json())

Steps to Reproduce

  1. Transcribe audio that contains location/state references
  2. The API returns entities with entity_type: "location_state"
  3. SDK fails to parse the response due to enum validation

Expected Behavior

The SDK should successfully parse API responses containing location_state entities.

Suggested Fix

Add location_state to the EntityType enum in assemblyai/types.py:

  class EntityType(str, Enum):
      # ... existing values ...
      location_state = "location_state"

Impact

This is a production-breaking issue - any transcription that returns a location_state entity will fail entirely, preventing users from getting transcription results.

Workarounds: [Unknown]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions