Practical overview
When it fits
Use it when an NLP workflow needs an LLM-backed task inside spaCy, especially for prompt-based prototyping or a task that benefits from flexible language understanding. The project suggests considering supervised models for well-defined production tasks where efficiency, reliability, control and accuracy are priorities.
Who it is for
- Python developers building NLP workflows with spaCy.
- Teams prototyping language-processing tasks with LLM prompts.
- Developers combining LLM-based steps with rule-based or supervised components.
Documented uses
- Add an LLM-backed component to an existing or new spaCy pipeline.
- Prototype named-entity recognition, classification or other supported NLP tasks.
- Define task prompts and parsing separately from the selected model.
- Combine prompted processing with other spaCy pipeline components.
Requirements & limits
The project is distributed as an MIT-licensed Python package. Its README documents installation with pip in an environment where spaCy is installed; the OpenAI quickstart uses an API key stored in environment variables.
- The library provides built-in tasks including entity recognition, text classification, lemmatization, relationship extraction, sentiment analysis, span categorization, summarization, entity linking, translation and raw p
- Model integrations listed include OpenAI, Cohere, Anthropic, Google PaLM, Microsoft Azure AI and Hugging Face-hosted open models; the README also describes LangChain integration.
- Task prompting and parsing are modular, and custom functions can be registered through spaCy's registry.
- A map-reduce approach is described for splitting prompts that exceed an LLM context window and combining results.
- The project warns that the interface is experimental and may have breaking changes in minor releases.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install Spacy LLM in a spaCy environment
Add the library to the Python virtual environment where spaCy is already installed.
Before you start
- Python environment with spaCy installed
- pip
Steps
Activate the virtual environment that contains spaCy.
Run the command below.
python -m pip install spacy-llm
Expected outcome
The package is installed in the environment alongside spaCy.
Guide limitations
- The project describes the interface as experimental and warns that minor releases may include breaking changes.
Configure a text-classification pipeline with an OpenAI model
Define and assemble a spaCy pipeline for LLM-backed text classification.
Before you start
- spaCy and spacy-llm installed in the same Python environment
- An OpenAI API key set as an environment variable
- A spaCy config file defining the language, llm component, text-classification task and model
Steps
Create a config file with an
llmpipeline component and aspacy.TextCat.v3task.Set the classification labels and specify the
spacy.GPT-4.v2model in the config.Use
spacy_llm.util.assembleto load the config and create the pipeline.Pass text to the pipeline and read the classification values from
doc.cats.
Expected outcome
A configured pipeline returns text-classification scores for the labels in the config.
Guide limitations
- The example depends on an OpenAI API key.
- The package interface is experimental and may change in minor version updates.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 13 October 2026
- Original website title
- explosion/spacy-llm · Official homepage title · retained in its source language

