Skip to content

Releases: aws/lex-helper

Release v0.0.3 - Documentation Infrastructure & Disambiguation Support

18 Sep 20:38
b100eba

Choose a tag to compare

🚀 What's New in v0.0.3

✨ Major Features

  • Disambiguation Support: Added both hardcoded and Bedrock-driven disambiguation responses (#3)
  • Complete Documentation Infrastructure: Professional MkDocs setup with Material theme and GitHub Pages integration
  • CI/CD Pipeline: Automated documentation deployment and enhanced testing workflows

📚 Documentation Improvements

  • Comprehensive documentation overhaul with better organization
  • Enhanced API documentation with detailed examples
  • Improved getting started guides and tutorials
  • Professional documentation structure with search capabilities

🔧 Development Experience

  • Pre-commit hooks for code quality and consistency
  • Improved testing infrastructure and validation
  • Enhanced development workflow with better tooling

🐛 Fixes

  • Fixed whitespace and formatting issues
  • Improved documentation sidebar navigation
  • Various minor fixes and improvements

📋 Full Changelog

See CHANGELOG.md for complete details.

Full Diff: v0.0.2...v0.0.3

v0.0.2 - Enhanced Exception Handling and Auto-Initialization

09 Sep 18:04
032f6b6

Choose a tag to compare

🚀 Major Features

Enhanced Exception Handling

  • Enhanced handle_exceptions function with optional custom error messages
  • Support for both message keys and direct strings in error handling
  • Automatic localization fallback when message keys are not found
  • Comprehensive unit tests for exception handling scenarios

Automatic Message Manager Initialization

  • Added auto_initialize_messages configuration option to Config class
  • Automatic MessageManager initialization with locale from Lex request
  • Eliminates need for manual initialize_message_manager() calls in Lambda functions
  • Graceful error handling for MessageManager initialization failures

Automatic Exception Handling in Lambda Functions

  • Added auto_handle_exceptions configuration option to Config class
  • Automatic exception handling and error response generation
  • Custom error message configuration via error_message parameter
  • Eliminates need for try/catch blocks in Lambda functions
  • Maintains proper Lex response formatting for all error scenarios

Message Consistency Testing Framework

  • Comprehensive test suite for message key consistency across locales
  • Validates all YAML message files have identical keys
  • Parameter consistency validation for message templates
  • Placeholder detection to prevent incomplete translations
  • Required message category validation

Dynamic Locale Detection in CDK

  • Automatic locale detection based on Lex bot export structure
  • Dynamic generation of bot locale configurations
  • Eliminates hardcoded locale lists in CDK stack
  • Reads confidence thresholds from BotLocale.json files

🔧 Improvements

Simplified Lambda Function Structure

  • Reduced Lambda function boilerplate by ~50% through automatic handling
  • Eliminated manual MessageManager initialization calls
  • Removed manual exception handling try/catch blocks
  • Streamlined configuration through enhanced Config class

Enhanced Deployment Scripts

  • Improved deployment script with better error handling
  • Automatic cleanup of old wheel files to prevent hash conflicts
  • Targeted uv cache cleaning for specific packages
  • Lock file regeneration to avoid dependency conflicts

Enhanced Testing

  • Added pytest to pre-commit hooks for continuous testing
  • Comprehensive test coverage for all new features
  • Message consistency validation across locales

📦 Technical Details

  • Enhanced Config class with new optional parameters
  • Improved error response creation with proper Lex formatting
  • Dynamic locale detection using filesystem scanning
  • All existing functionality preserved while improving developer experience

🎉 Lex Helper v0.0.1 - Initial Release

03 Sep 22:31
dde1183

Choose a tag to compare

🎉 Lex Helper v0.0.1 - Initial Release

We're excited to announce the first official release of Lex Helper, a modern, type-safe Python library for building Amazon Lex chatbots with ease!

🚀 What is Lex Helper?

Lex Helper simplifies building Amazon Lex fulfillment lambdas by providing:

  • Type-safe session attributes with Pydantic models
  • Simplified intent management with automatic file-based routing
  • Channel-aware formatting for SMS, Lex console, and other channels
  • Comprehensive dialog utilities for managing conversation flow
  • Amazon Bedrock integration for AI-powered responses

✨ Key Features

🎯 Simplified Intent Management

Each intent's logic lives in its own file under an intents/ directory, making it easy to locate, maintain, and scale your bot's capabilities.

🔒 Type-Safe Session Attributes

Define your session attributes as Pydantic models, eliminating runtime errors from typos or incorrect data types. Get full IDE autocomplete support!

🤖 Amazon Bedrock Integration

  • Direct integration with Amazon Bedrock models
  • Support for Claude, Titan, Jurassic, Cohere, and Llama models
  • Both Converse API and InvokeModel API support
  • Automatic fallback between on-demand and inference profiles

🌐 Message Management

  • Centralized message management with locale support
  • YAML-based message files with automatic fallback
  • Support for multiple locales (messages_{localeId}.yaml)

🛠 Developer Experience

  • Full type hint support with py.typed
  • Comprehensive error handling
  • Modern Python tooling (Python 3.12+)
  • Extensive documentation and examples

📦 Installation

pip install lex-helper

For optional Bedrock features:

pip install lex-helper[bedrock]

🚀 Quick Start

1. Create Session Attributes

from pydantic import ConfigDict, Field
from lex_helper import SessionAttributes

class CustomSessionAttributes(SessionAttributes):
    model_config = ConfigDict(extra="allow")
    user_name: str = Field(default="", description="User's name")
    visit_count: int = Field(default=0, description="Number of visits")

2. Create Main Handler

from typing import Any
from lex_helper import Config, LexHelper
from .session_attributes import CustomSessionAttributes

def lambda_handler(event: dict[str, Any], context: Any) -> dict[str, Any]:
    config = Config(
        session_attributes=CustomSessionAttributes(),
        package_name="your_project.intents"
    )
    lex_helper = LexHelper(config=config)
    return lex_helper.handler(event, context)

3. Create Intent Handlers

Structure your intents in an intents/ directory - the library will automatically route to the correct handler based on intent name!

📚 Documentation

🔧 What's Included

Core Features

  • Type-safe session attributes with Pydantic models
  • Simplified intent management with automatic file-based routing
  • Comprehensive dialog utilities (get_intent, get_slot, set_slot, elicit_intent, etc.)
  • Channel-aware formatting for SMS, Lex console, and other channels
  • Automatic request/response handling for Lex fulfillment lambdas

Message Management

  • Centralized message management with locale support
  • YAML-based message files with automatic fallback
  • Support for multiple locales

Bedrock Integration

  • Direct integration with Amazon Bedrock models
  • Support for multiple model families
  • Converse API and InvokeModel API support
  • Automatic fallback mechanisms

Developer Experience

  • Full type hint support
  • Comprehensive error handling and exception management
  • Modern Python tooling
  • Extensive documentation and examples

Package Infrastructure

  • Professional PyPI package with comprehensive metadata
  • Automated CI/CD with GitHub Actions
  • Dynamic version management
  • Optional dependencies for flexible installation

🎯 Perfect For

  • AWS Lambda developers building Lex fulfillment functions
  • Chatbot developers who want type safety and better organization
  • Teams looking for maintainable, scalable bot architectures
  • Developers who prefer modern Python practices and tooling

🤝 Contributing

We welcome contributions! See our Contributing Guide for details.

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

🙏 Acknowledgments

Built with ❤️ by the AWS team to make Lex development more enjoyable and productive.


Ready to build better bots? Install Lex Helper today and experience the difference!

pip install lex-helper