spaCy: [E892] Unknown function registry: 'llm_backends'

How to reproduce the behaviour

I’m getting an “Unknown function registry: ‘llm_backends’” error (see the traceback below) when running the example provided in Matthew Honnibal’s blog “Against LLM maximalism” (https://explosion.ai/blog/against-llm-maximalism)

import spacy

nlp = spacy.blank("en")
nlp.add_pipe("sentencizer")
nlp.add_pipe(
    "llm",
    config={
        "task": {
            "@llm_tasks": "spacy.NER.v1",
            "labels": "SAAS_PLATFORM,PROGRAMMING_LANGUAGE,OPEN_SOURCE_LIBRARY"
        },
        "backend": {
            "@llm_backends": "spacy.REST.v1",
            "api": "OpenAI",
            "config": {"model": "text-davinci-003"},
        },
    },
)

doc = nlp("There's no PyTorch bindings for Go. We just use Microsoft Cognitive Services.")
for ent in doc.ents:
    print(ent.text, ent.label_, ent.sent)

Here is the full traceback:

File “/Users/ron.katriel/PycharmProjects/NLP/spacy-llm-example.py”, line 5, in <module> nlp.add_pipe( File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/spacy/language.py”, line 786, in add_pipe pipe_component = self.create_pipe( File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/spacy/language.py”, line 679, in create_pipe resolved = registry.resolve(cfg, validate=validate) File “/Users/ron.katriel/PycharmProjects/Labs-Gen-AI/venv/lib/python3.10/site-packages/confection/init.py”, line 756, in resolve resolved, _ = cls._make( File “/Users/ron.katriel/PycharmProjects/Labs-Gen-AI/venv/lib/python3.10/site-packages/confection/init.py”, line 805, in _make filled, _, resolved = cls._fill( File “/Users/ron.katriel/PycharmProjects/Labs-Gen-AI/venv/lib/python3.10/site-packages/confection/init.py”, line 860, in _fill filled[key], validation[v_key], final[key] = cls._fill( File “/Users/ron.katriel/PycharmProjects/Labs-Gen-AI/venv/lib/python3.10/site-packages/confection/init.py”, line 859, in _fill promise_schema = cls.make_promise_schema(value, resolve=resolve) File “/Users/ron.katriel/PycharmProjects/Labs-Gen-AI/venv/lib/python3.10/site-packages/confection/init.py”, line 1051, in make_promise_schema func = cls.get(reg_name, func_name) File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/spacy/util.py”, line 128, in get raise RegistryError(Errors.E892.format(name=registry_name, available=names)) catalogue.RegistryError: [E892] Unknown function registry: ‘llm_backends’.

Available names: architectures, augmenters, batchers, callbacks, cli, datasets, displacy_colors, factories, initializers, languages, layers, lemmatizers, llm_misc, llm_models, llm_queries, llm_tasks, loggers, lookups, losses, misc, models, ops, optimizers, readers, schedules, scorers, tokenizers

Your Environment

  • spaCy version: 3.5.1
  • Platform: macOS-13.5.2-x86_64-i386-64bit
  • Python version: 3.10.4

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

Done! The new issue is “Spacy-LLM fails with storage not allocated on MPS device” https://github.com/explosion/spaCy/issues/13096