Openai-structured

Latest version: v3.0.0

Safety actively analyzes 722460 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 4

3.0.0

Breaking Changes

- Renamed `model_name` field to `openai_model_name` in `ModelCapabilities` class
- Any code referencing the `model_name` property will need to be updated
- All constructor calls using the `model_name` parameter must be changed to use `openai_model_name`

Fixed

- Resolved an issue where using field names starting with "model_" in Pydantic models would trigger protected namespace warnings

2.1.0

Added

- Enhanced registry update mechanism with HTTP caching
- Added `RegistryUpdateStatus` enum and `RegistryUpdateResult` dataclass for detailed status reporting
- Added `check_for_updates` method to check for available updates without downloading
- Added `--check` option to `openai-structured-refresh` command
- Added cache metadata tracking via `.yml.meta` files for ETag and Last-Modified headers

Changed

- Improved HTTP request efficiency with conditional requests
- Added support for ETag and If-Modified-Since headers
- Reduced bandwidth usage by avoiding unnecessary downloads
- Enhanced verbose output in CLI
- Added local registry file path to output
- Improved token size display with human-readable K format
- Added detailed status information in verbose mode
- Updated error handling with more specific status codes and messages

Fixed

- Improved streaming response handling to prevent content loss
- Modified `StreamBuffer.close()` to extract final responses before closing
- Updated stream functions to properly handle and yield final content
- Made streaming tests more resilient to API response variations

2.0.1

Added

- Added support for GPT-4.5 Preview model:
- New dated model `gpt-4.5-preview-2025-02-27` with 128K context window and 16K output tokens
- New alias `gpt-4.5-preview` pointing to the dated model
- Full parameter validation and constraint support

Fixed

- Improved `update_fallbacks.py` script to properly handle ModelVersion as dictionaries
- Updated fallback models with the latest configuration

2.0.0

Breaking Changes

- Model Registry Architecture:
- Introduced singleton ModelRegistry for centralized model management
- Strict version validation for all model names
- Required model capabilities validation through registry
- Removed direct model support checks in favor of registry-based validation

- Parameter Validation:
- Added mandatory parameter validation for all model parameters
- Parameters must now match model-specific constraints
- `max_output_tokens` and `max_completion_tokens` are now mutually exclusive
- Removed support for unvalidated parameters

- Error Handling:
- Restructured error hierarchy with new specific error types
- Changed error message format to include more context
- Added new `TokenParameterError` for token parameter conflicts
- Some error types now include additional context (e.g., available models, parameter constraints)

Added

- Enhanced model registry with comprehensive validation
- Support for new model variants and aliases
- Comprehensive parameter validation with constraints
- Live testing capabilities
- Improved type hints and documentation
- New error types for better error handling
- Enhanced streaming support with better buffer management

Changed

- Complete refactor of model registry and validation system
- Improved error handling and reporting
- Enhanced error messages with more descriptive information
- Added parameter type details and allowed values
- Included model version format examples
- Added categorized lists of available models
- Added suggestions for using aliases
- Enhanced type safety across the codebase
- Updated model specifications and requirements
- Improved documentation
- Added comprehensive error handling examples
- Enhanced exception documentation
- Added testing examples section
- Updated model registry documentation
- Improved code organization
- Fixed linting issues and removed unused imports
- Enhanced import organization in test files
- Improved code readability and maintainability

Removed

- Deprecated model versions and outdated validation methods
- Legacy error handling patterns

1.3.0

Added

- Support for token limit validation
- Added `get_context_window_limit` function
- Added `get_default_token_limit` function
- Added `TokenLimitError` exception class
- Enhanced model token limit documentation
- Updated model specifications
- Added token limit examples
- Improved error handling documentation

Changed

- Improved error handling for token limits
- Added token limit validation in request preparation
- Enhanced error messages with detailed token information
- Updated examples with token limit handling

1.2.0

Added

- New `ClosedBufferError` class for better error handling of closed buffer states
- Enhanced mypy configuration for improved type checking and package structure

Changed

- Improved error handling in StreamBuffer
- Fixed incorrect error type when writing to closed buffer
- Better error variable naming for clarity
- Enhanced error documentation
- Fixed import paths to use installed package structure
- Updated mypy configuration for better src layout support
- Added proper path configuration
- Improved cache management
- Enhanced import handling
- Added Pydantic-specific overrides

Fixed

- Bug fix: Using correct error type (`ClosedBufferError` instead of `BufferOverflowError`) when writing to closed buffer
- Import path in test files to use installed package path

Page 1 of 4

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.