llm/llm/hookspecs.py
Simon Willison 77cf56e54a
Initial CLI support and plugin hook for embeddings, refs #185
* Embeddings plugin hook + OpenAI implementation
* llm.get_embedding_model(name) function
* llm embed command, for returning embeddings or saving them to SQLite
* Tests using an EmbedDemo embedding model
* llm embed-models list and emeb-models default commands
* llm embed-db path and llm embed-db collections commands
2023-08-27 22:24:10 -07:00

20 lines
492 B
Python

from pluggy import HookimplMarker
from pluggy import HookspecMarker
hookspec = HookspecMarker("llm")
hookimpl = HookimplMarker("llm")
@hookspec
def register_commands(cli):
"""Register additional CLI commands, e.g. 'llm mycommand ...'"""
@hookspec
def register_models(register):
"Return a list of model instances representing LLM models that can be called"
@hookspec
def register_embedding_models(register):
"Return a list of model instances that can be used for embedding"