_resources_proxy.py 589 B

123456789101112131415161718192021222324
  1. from __future__ import annotations
  2. from typing import Any
  3. from typing_extensions import override
  4. from ._proxy import LazyProxy
  5. class ResourcesProxy(LazyProxy[Any]):
  6. """A proxy for the `openai.resources` module.
  7. This is used so that we can lazily import `openai.resources` only when
  8. needed *and* so that users can just import `openai` and reference `openai.resources`
  9. """
  10. @override
  11. def __load__(self) -> Any:
  12. import importlib
  13. mod = importlib.import_module("openai.resources")
  14. return mod
  15. resources = ResourcesProxy().__as_proxied__()