spacy-llm  by explosion

spaCy plugin for LLM-powered NLP pipelines

created 2 years ago
1,289 stars

Top 31.6% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This package integrates Large Language Models (LLMs) into spaCy's structured NLP pipelines, enabling rapid prototyping of NLP tasks without requiring training data. It targets developers and researchers seeking to leverage LLMs for tasks like NER, text classification, and summarization, offering a flexible way to combine LLM-powered components with traditional spaCy models.

How It Works

spacy-llm provides a modular system for defining LLM tasks, including prompting and response parsing. It offers interfaces to major LLM providers (OpenAI, Cohere, Anthropic, Google, Azure) and Hugging Face hosted open-source models. The package supports LangChain integration and includes a map-reduce approach for handling prompts exceeding context window limits, allowing for efficient processing of large documents.

Quick Start & Requirements

  • Install via pip: python -m pip install spacy-llm
  • Requires spaCy installation.
  • API keys for LLM providers (e.g., OpenAI) must be set as environment variables.
  • Official documentation: https://spacy.io/api/large-language-models

Highlighted Details

  • Integrates LLMs as serializable spaCy components.
  • Supports a wide range of tasks out-of-the-box, including NER, text classification, summarization, and more.
  • Enables custom task implementation via spaCy's registry.
  • Offers map-reduce for long context window handling.

Maintenance & Community

  • Bug reports can be filed on the spaCy issue tracker.
  • Discussion board available for questions and feedback.
  • Migration guides are provided.

Licensing & Compatibility

  • The package itself is likely distributed under a permissive license compatible with spaCy's ecosystem (e.g., MIT), but users must adhere to the terms of service of the LLM providers used.

Limitations & Caveats

This package is experimental, and minor version updates may introduce breaking changes to the interface. While LLMs are powerful for prototyping, the README notes that traditional supervised learning models often offer better efficiency, reliability, control, and accuracy for production use cases when sufficient training data is available.

Health Check
Last commit

6 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
51 stars in the last 90 days

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Anton Troynikov Anton Troynikov(Cofounder of Chroma), and
20 more.

llama_index by run-llama

0.3%
43k
Data framework for building LLM-powered agents
created 2 years ago
updated 23 hours ago
Feedback? Help us improve.