llm/llm/plugins.py
Simon Willison ae87f978bd Moved iter_prompt from Response to Model, moved a lot of other stuff
- Moved a whole bunch of things from llm/cli.py into llm/__init__.py
- Switched plugin listings to use importlib.metadata to avoid deprecation warning
- iter_prompt() is now a method on Model, not on Response
2023-07-10 07:45:11 -07:00

17 lines
419 B
Python

import importlib
import pluggy
import sys
from . import hookspecs
DEFAULT_PLUGINS = ("llm.default_plugins.openai_models",)
pm = pluggy.PluginManager("llm")
pm.add_hookspecs(hookspecs)
if not hasattr(sys, "_called_from_test"):
# Only load plugins if not running tests
pm.load_setuptools_entrypoints("llm")
for plugin in DEFAULT_PLUGINS:
mod = importlib.import_module(plugin)
pm.register(mod, plugin)