spacy-llm icon indicating copy to clipboard operation
spacy-llm copied to clipboard

[BUG] context_length does not work with NER

Open psydok opened this issue 10 months ago • 0 comments

I'm trying to verify the context_length field works. CustomLLM is a fully inherited class from your OpenAI implementation, but without verification checking. I initialize the class and send a request - in the request I see full text of ~2000 characters. I thought a split should happen though.

config.cfg

[nlp]
lang = "en"
pipeline = ["llm"]

[components]

[components.llm]
factory = "llm"

[components.llm.task]
@llm_tasks = "spacy.NER.v3"
labels = ["PERSON", "LOCATION"]
description = Entities are names of people without title, names of streets, names of cities, names of countries, names of towns.
    Adjectives, verbs, adverbs are not entities.
    Pronouns are not entities.
alignment_mode = strict

[components.llm.task.label_definitions]
PERSON = "A named individual found in the text."
LOCATION = "A names of location."

[components.llm.task.examples]
@misc = "spacy.FewShotReader.v1"
path = "ner_examples.json"

[components.llm.model]
@llm_models = "CustomLLM"
name = "Qwen/Qwen2.5-7B-Instruct"
endpoint = "http://localhost:8000/v1/chat/completions"
config = {"temperature": 0, "seed": 42}
max_tries = 5
max_request_time = 300
interval = 30
context_length = 500

[components.llm.task.normalizer]
@misc = "spacy.LowercaseNormalizer.v1"

psydok avatar Feb 22 '25 09:02 psydok