Utils#
dependency_control#
cache_func#
error#
- exception gptcache.utils.error.NotInitError[source]#
Bases:
gptcache.utils.error.CacheError
Raise when the cache has been used before it’s inited
- exception gptcache.utils.error.NotFoundError(store_type, current_type_name)[source]#
Bases:
gptcache.utils.error.CacheError
Raise when getting an unsupported store.
- exception gptcache.utils.error.ParamError[source]#
Bases:
gptcache.utils.error.CacheError
Raise when receiving an invalid param.
- exception gptcache.utils.error.PipInstallError(package)[source]#
Bases:
gptcache.utils.error.CacheError
Raise when failed to install package.
- gptcache.utils.error.wrap_error(e: Exception) Exception [source]#
Add a type to exception e while ensuring that the original type is not changed
Example
import openai from gptcache.utils.error import wrap_error def raise_error(): try: raise openai.error.OpenAIError(message="test") except openai.error.OpenAIError as e: raise wrap_error(e) try: raise_error() except openai.error.OpenAIError as e: print("exception:") print(e) print("over")