misc_utils
Miscellaneous utility functions that support operations performed by other modules in the okcourse library.
Functions:
| Name | Description |
|---|---|
extract_literal_values_from_member |
|
extract_literal_values_from_type |
extract_literal_values_from_member
Extracts the Literal values of a specified member in a class or TypedDict.
If the member's type is a Literal or contains literals within a Union like
Optional[Literal[...]], the function extracts and returns all the Literal values.
An example use case for this function is to extract a list of the available models from an OpenAI library type.