explosion

spacy-llm: Add LLM Tasks to spaCy NLP Pipelines

spacy-llm connects large language models to spaCy pipelines, turning model responses into structured NLP outputs without training data. It suits teams prototyping NLP tasks or combining LLM components with conventional spaCy processing.

View on GitHub Compare
Stars
1.4k
Forks
112
Stars, last 30 days
+2

Our take

Health score

47/100

How it is scored
Activity
44
Community
53
Issues
46
Pull requests
46

+2 stars in the last 30 days

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

1,399

Forks

111

Change since Nov 15, 2026: 0 stars·0 forks

Overview

spacy-llm is a Python package that adds LLM-powered components to spaCy, a library for building natural language processing systems. It provides a configurable way to prompt models for tasks and parse their responses into structured results that fit into spaCy pipelines.

It is useful when you need to prototype an NLP task with little or no labeled data, or when a pipeline benefits from combining LLM prompting with rule-based or supervised components. The project frames prompting as a flexible starting point, not a universal replacement for trained models, which may be more efficient and reliable for well-defined production tasks.

Key Features

  • Adds a serializable llm component to spaCy pipelines.
  • Separates task definitions, including prompting and parsing, from model integrations.
  • Provides built-in tasks such as named entity recognition, text classification, summarization, translation, and entity linking.
  • Connects to hosted model APIs and supports open-source models hosted on Hugging Face.
  • Supports LangChain models and features.
  • Offers registry-based extension points for custom tasks, prompts, parsers, and model integrations.
  • Can split long inputs and combine results using a map-reduce approach.

Use Cases

  • NLP developers can quickly test a classification or extraction task before assembling labeled training data.
  • Teams can add LLM-based entity recognition or summarization to an existing spaCy pipeline while retaining other processing components.
  • Researchers can experiment with prompts and parsing strategies across supported model integrations.
  • Application developers can use an LLM for nuanced text processing and surround it with conventional components for filtering or output checks.

Getting Started

Install the package in the same virtual environment as spaCy:

python -m pip install spacy-llm

See the README and spaCy LLM documentation for configuration, examples, and API key setup.

Considerations

  • The README describes the package as experimental and warns that interfaces may change in minor version updates.
  • Using hosted models requires access to the relevant provider and, for API-based use, configured credentials.
  • LLM prompting can be less efficient and reliable than a supervised model for a well-defined production task. Evaluate whether an LLM is justified for each component.
  • Model availability, requirements, and costs depend on the integration selected.

Found this useful?

Share it with someone who would like spacy-llm.