Skip to content

[BUG] context_length does not work with NER #496

@psydok

Description

@psydok

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions