What is StructuredBot?
mainStructuredBot is a specialized bot class designed for scenarios requiring guaranteed structured outputs from LLMs. Unlike SimpleBot, which returns raw text, StructuredBot provides:
- Pydantic schema validation: Enforces the structure defined by your Pydantic models.
- Automatic retries: Automatically attempts to fix the output if the LLM produces invalid data.
- Validated objects: Returns actual Pydantic model instances instead of strings.
- Error reporting: Provides clear error messages when validation fails after all retry attempts.