Deprecation
openai_model_registry.deprecation
¶
Deprecation support for model registry.
This module provides deprecation metadata and validation for models.
Classes¶
DeprecationInfo
dataclass
¶
Deprecation metadata for a model.
All fields are mandatory in the current schema.
Source code in src/openai_model_registry/deprecation.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
Functions¶
__post_init__()
¶
Validate deprecation dates are properly ordered.
Source code in src/openai_model_registry/deprecation.py
26 27 28 29 |
|
InvalidSchemaVersionError
¶
Bases: Exception
Raised when the schema version is not supported.
Source code in src/openai_model_registry/deprecation.py
41 42 43 44 45 46 47 |
|
ModelSunsetError
¶
Bases: Exception
Raised when attempting to access a sunset model.
Source code in src/openai_model_registry/deprecation.py
32 33 34 35 36 37 38 |
|
Functions¶
assert_model_active(model, deprecation_info)
¶
Assert that a model is active and warn if deprecated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
str
|
Model name |
required |
deprecation_info
|
DeprecationInfo
|
Deprecation metadata |
required |
Raises:
Type | Description |
---|---|
ModelSunsetError
|
If the model is sunset |
Warns:
Type | Description |
---|---|
DeprecationWarning
|
If the model is deprecated |
Source code in src/openai_model_registry/deprecation.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
sunset_headers(deprecation_info)
¶
Generate RFC-compliant HTTP headers for deprecation status.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deprecation_info
|
DeprecationInfo
|
Deprecation metadata |
required |
Returns:
Type | Description |
---|---|
Dict[str, str]
|
Dictionary of HTTP headers |
Source code in src/openai_model_registry/deprecation.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|