Skip to content

fix(compiler): Make pluralization model optional when disabled #1981

@ShashwatpSingh

Description

@ShashwatpSingh

Problem

The PluralizationConfig type currently requires a model string even when enabled: false. This forces users to provide API keys and model configuration for a feature they're not using.

Current Behavior

  • model is always required in PluralizationConfig
  • PluralizationService constructor always initializes the AI model
  • API keys are validated even when pluralization is disabled

Expected Behavior

  • model should only be required when enabled: true
  • Model should be lazy-initialized only when needed
  • No unnecessary API calls when pluralization is disabled

Proposed Solution

  1. Make model optional in PluralizationConfig: model?: string
  2. Add runtime check: throw error if enabled: true but no model
  3. Move model initialization from constructor to generateBatch() method

Benefits

  • Better DX: Users don't need to configure unused features
  • Performance: No unnecessary model initialization
  • Resource efficiency: No API key validation when not needed
  • Cleaner config: Only required fields when disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions