How the Pokemon Build Assistant Works

The application sends each message to the AI, and the backend decides whether to build, revise, explain, or answer in chat mode.

System Flow
This page reflects the current routing and validation logic in the backend service.

1. Intent routing

The backend first classifies each message as build generation, build revision, explanation, matchup advice, or general chat.

2. Structured generation

For build requests, the model must return a full PokémonBuild object with species, role, item, ability, nature, four moves, stat points, and an explanation.

3. Validation and retry

The response is validated against the schema and stat-point rules. If it fails, the backend retries with corrective feedback up to three times.

4. Session-aware chat

For explanation, matchup, and general chat requests, the assistant answers in plain text while using the latest saved build and recent session messages as context.