Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test for custom task construction #405

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions spacy_llm/tests/tasks/test_custom.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
from typing import Iterable

from confection import Config
from spacy.tokens import Doc

from spacy_llm.registry import registry
from spacy_llm.util import assemble
from spacy_llm.util import assemble_from_config

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

[components]

[components.llm]
factory = "llm"
save_io = True

[components.llm.task]
@llm_tasks = "my_namespace.MyTask.v1"

[components.llm.model]
@llm_models = "spacy.NoOp.v1"
"""


@registry.llm_tasks("my_namespace.MyTask.v1")
Expand All @@ -26,5 +44,5 @@ def parse_responses(


def test_custom_task():
nlp = assemble("custom.cfg")
nlp = assemble_from_config(Config().from_str(config))
nlp("This is a test.")