# explosion/spacy-llm

🦙 Integrating LLMs into structured NLP pipelines

Repository: https://github.com/explosion/spacy-llm
Canonical: https://ross.abutalabs.com/products/spacy-llm
Homepage: https://spacy.io/usage/large-language-models
Language: Python
License: MIT
License Family: permissive
Topics: large-language-models, llm, openai, spacy, dolly, gpt-3, gpt-4, machine-learning, named-entity-recognition, natural-language-processing, nlp, text-classification, prompt-engineering, anthropic, claude, cohere, falcon, llama
Last push: 2026-03-27T08:49:38+00:00

## Health v2 (maintenance only)
Score: 67/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 74, release rhythm 44, longevity 90
- inputs: {"age_days": 1266, "days_push": 159, "days_rel": 162, "gap_med": 435, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1394, forks 109 (observed 2026-08-28T04:04:36.405290+00:00)

## What it is
spacy-llm is a Python library that integrates Large Language Models into spaCy NLP pipelines via a serializable llm component. It provides modular task and model abstractions for prompting and parsing LLM responses into robust structured outputs for NLP tasks without training data.

## Use cases
- extract named entities from text using gpt-4 without training data
- add llm-based text classification to a spacy pipeline
- prototype prompts for nlp tasks like relation extraction or summarization
- use open-source llms like llama or mistral for zero-shot ner
- turn unstructured llm responses into structured spacy doc annotations
- run sentiment analysis and lemmatization with an llm api

## When to choose
- you already use spaCy and want LLM capabilities inside your existing pipeline
- you need structured, parsed outputs from LLMs for standard NLP tasks
- you want to swap between hosted APIs (OpenAI, Anthropic, Cohere) and self-hosted open-source models
- you want fast zero-shot prototyping without labeled training data

## When to avoid
- you need a general-purpose LLM agent or chat framework rather than structured NLP tasks
- your project doesn't use spaCy and you don't want the dependency
- you need fine-grained control over raw LLM API calls outside a pipeline abstraction

## Facets
- artifact type: library
- maturity: active
- function: nlp, llm-inference, prompt-engineering, machine-learning, parser
- domain: large-language-models, machine-learning, developer-tools
- platform: python, cross-platform
- tags: spacy, llm-pipeline, named-entity-recognition, text-classification, openai, anthropic, huggingface, langchain, zero-shot-nlp, natural-language-processing

## Member repositories
- explosion/spacy-llm (main) score 67

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:36.405290+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:39:26.432506+00:00, confidence not recorded.
  - readme: https://github.com/explosion/spacy-llm (fetched 2026-08-28T04:04:36.405290+00:00, sha e3fa213abd59)
  - homepage: https://spacy.io/usage/large-language-models (fetched 2026-08-29T11:54:15.741542+00:00, sha 623e9fafc43c)
  - site_page: https://spacy.io/usage/linguistic-features (fetched 2026-08-29T11:54:15.753504+00:00, sha 15f0372dd6a7)
  - registry_pypi: https://pypi.org/pypi/spacy-llm/json (fetched 2026-08-29T11:54:15.762267+00:00, sha d7d4ca1e16d6)
  - site_page: https://spacy.io/usage (fetched 2026-08-29T11:54:15.751138+00:00, sha b80b5dfe308d)
  - site_page: https://spacy.io/api/language (fetched 2026-08-29T11:54:15.759681+00:00, sha 243bc73adaeb)
- Data as of 2026-08-30T08:39:29.467469+00:00.
