cfahlgren1 / observers

A Lightweight Library for AI Observability
190 stars 20 forks source link

[FEAT] Add support for `spaCy` pipelines #9

Open davidberenstein1957 opened 1 week ago

davidberenstein1957 commented 1 week ago

We want to add support for basic spacy models and pipeline. Try to get inspiration from https://github.com/cfahlgren1/observers/blob/main/src/observers/observers/models/openai.py

import spacy
from observers.observers.models.spacy import wrap_spacy

texts = [
    "Net income was $9.4 million compared to the prior year of $2.7 million.",
    "Revenue exceeded twelve billion dollars, with a loss of $1b.",
]

nlp = spacy.load("en_core_web_sm")
nlp = wrap_spacy(nlp)

We might need to differentiate tracking different tasks like NER/Textcat. Similarly, taking a look at https://github.com/explosion/spacy-llm would be interesting.