repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.tokens import Doc
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from spacy_llm.tasks.lemma import LemmaTask
from spacy_llm.util import assemb... | len(examples) | assert | func_call | spacy_llm/tests/tasks/test_lemma.py | test_lemma_init | 379 | null | |
explosion/spacy-llm | import copy
import pytest
import spacy
from confection import Config # type: ignore[import]
from thinc.compat import has_torch_cuda_gpu
from ...compat import torch
_PIPE_CFG = {
"model": {
"@llm_models": "spacy.StableLM.v1",
"name": "stablelm-base-alpha-3b",
},
"task": {"@llm_tasks": "sp... | ValueError, match="unexpected value; permitted:") | pytest.raises | complex_expr | spacy_llm/tests/models/test_stablelm.py | test_invalid_model | 84 | null | |
explosion/spacy-llm | import json
from pathlib import Path
import pytest
from confection import Config
from pytest import FixtureRequest
from spacy.tokens import Doc, Span
from spacy.training import Example
from spacy.util import get_lang_class
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.tasks.rel import DEFAULT_REL_TEMPLATE,... | tuple(labels) | assert | func_call | spacy_llm/tests/tasks/test_rel.py | test_rel_config | 131 | null | |
explosion/spacy-llm | import json
import re
from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader... | task.labels | assert | complex_expr | spacy_llm/tests/tasks/legacy/test_ner.py | test_ner_config | 205 | null | |
explosion/spacy-llm | from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy... | n_detections / 2 | assert | complex_expr | spacy_llm/tests/tasks/test_spancat.py | test_spancat_scoring | 550 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma... | 0 | assert | numeric_literal | spacy_llm/tests/tasks/legacy/test_spancat.py | test_spancat_predict | 110 | null | |
explosion/spacy-llm | import numbers
from pathlib import Path
import pytest
from confection import Config
from spacy.pipeline import EntityLinker
from spacy.tokens import Span
from spacy_llm.tests.compat import has_openai_key
from spacy_llm.util import assemble_from_config
from .util import ShardingCountTask # noqa: F401
_CONTEXT_LENGT... | 3 | assert | numeric_literal | spacy_llm/tests/sharding/test_sharding.py | test_sharding_spancat | 190 | null | |
explosion/spacy-llm | import numbers
from pathlib import Path
import pytest
from confection import Config
from spacy.pipeline import EntityLinker
from spacy.tokens import Span
from spacy_llm.tests.compat import has_openai_key
from spacy_llm.util import assemble_from_config
from .util import ShardingCountTask # noqa: F401
_CONTEXT_LENGT... | [ "Do one thing every day that scares you. The ", "only thing we have to fear is fear itself.", ] | assert | collection | spacy_llm/tests/sharding/test_sharding.py | test_sharding_lemma | 84 | null | |
explosion/spacy-llm | import copy
import pytest
import spacy
from confection import Config # type: ignore[import]
from thinc.compat import has_torch_cuda_gpu
from ...compat import torch
_PIPE_CFG = {
"model": {
"@llm_models": "spacy.Falcon.v1",
"name": "falcon-rw-1b",
},
"task": {"@llm_tasks": "spacy.NoOp.v1"... | ["llm"] | assert | collection | spacy_llm/tests/models/test_falcon.py | test_init_from_config | 59 | null | |
explosion/spacy-llm | import json
from pathlib import Path
import pytest
from confection import Config
from pytest import FixtureRequest
from spacy.tokens import Doc, Span
from spacy.training import Example
from spacy.util import get_lang_class
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.tasks.rel import DEFAULT_REL_TEMPLATE,... | list(nlp.get_pipe("llm")._task.generate_prompts([doc]))[0][0][0] | assert | func_call | spacy_llm/tests/tasks/test_rel.py | test_labels_in_prompt | 287 | null | |
explosion/spacy-llm | import logging
import sys
import warnings
from pathlib import Path
from typing import Any, Dict, Iterable, Optional, Tuple
import pytest
import spacy
import srsly
from confection import Config
from spacy.language import Language
from spacy.tokens import Doc
from spacy.util import make_tempdir
from thinc.api import Num... | "Test 2" | assert | string_literal | spacy_llm/tests/pipeline/test_llm.py | test_llm_custom_data_overwrite | 474 | null | |
explosion/spacy-llm | import json
from pathlib import Path
from typing import Iterable
import pytest
import spacy
import srsly
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader, lowercase_... | label | assert | variable | spacy_llm/tests/tasks/test_textcat.py | test_textcat_binary_labels_are_correct | 322 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
from thinc.compat import has_torch_cuda_gpu
from spacy_llm import cache # noqa: F401
from spacy_llm.tests.compat import has_openai_key
from .. import el_openai, multitask_openai, ner_dolly, ner_langchain_openai
from .. import ner_v3_openai, rel_openai, textcat_openai
_USAGE_E... | 1 | assert | numeric_literal | usage_examples/tests/test_usage_examples.py | test_el_openai | 33 | null | |
explosion/spacy-llm | from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy... | found_substrings | assert | variable | spacy_llm/tests/tasks/test_spancat.py | test_ensure_offsets_correspond_to_substrings | 223 | null | |
explosion/spacy-llm | import pytest
from spacy_llm.tasks.span import SpanReason
SPAN_REASON_FROM_STR_TEST_CASES = {
"invalid_order_no_error": (
"1. Golden State Warriors | BASKETBALL_TEAM | is a basketball team in the NBA | True",
SpanReason(
text="Golden State Warriors",
is_entity=False,
... | expected | assert | variable | spacy_llm/tests/tasks/test_span_utils.py | test_span_reason_from_str | 51 | null | |
explosion/spacy-llm | import json
import re
from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
import srsly
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.co... | 3 | assert | numeric_literal | spacy_llm/tests/tasks/test_ner.py | test_clear_label | 1,031 | null | |
explosion/spacy-llm | import copy
import pytest
import spacy
from confection import Config # type: ignore[import]
from thinc.compat import has_torch_cuda_gpu
from ...compat import torch
_PIPE_CFG = {
"model": {
"@llm_models": "spacy.Dolly.v1",
"name": "dolly-v2-3b",
},
"task": {"@llm_tasks": "spacy.NoOp.v1"},... | ValueError, match="unexpected value; permitted") | pytest.raises | complex_expr | spacy_llm/tests/models/test_dolly.py | test_invalid_model | 69 | null | |
explosion/spacy-llm | import json
import re
from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
import srsly
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.co... | 0 | assert | numeric_literal | spacy_llm/tests/tasks/test_ner.py | test_ner_io | 291 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.registry import file_reader
from spacy_llm.util import assemble_from_config
from ...tasks import RawTask, make_raw_task
from ..compat import has_open... | f""" This is a test RAW template. Here is the text: {text} """.strip() | assert | string_literal | spacy_llm/tests/tasks/test_raw.py | test_external_template_actually_loads | 239 | null | |
explosion/spacy-llm | from typing import Tuple
import pytest
import spacy
from thinc.compat import has_torch_cuda_gpu
from spacy_llm.compat import has_accelerate, torch
_PIPE_CFG = {
"model": {
"@llm_models": "",
"name": "",
},
"task": {"@llm_tasks": "spacy.NoOp.v1"},
"save_io": True,
}
@pytest.mark.gpu
@... | torch.float16 | assert | complex_expr | spacy_llm/tests/models/test_hf.py | test_torch_dtype | 67 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma... | {"PER", "LOC"} | assert | collection | spacy_llm/tests/tasks/legacy/test_spancat.py | test_spancat_init | 572 | null | |
explosion/spacy-llm | from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy... | ["llm"] | assert | collection | spacy_llm/tests/tasks/test_spancat.py | test_spancat_config | 147 | null | |
explosion/spacy-llm | import json
from pathlib import Path
from typing import Iterable
import pytest
import spacy
import srsly
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader, lowercase_... | task.labels | assert | complex_expr | spacy_llm/tests/tasks/test_textcat.py | test_textcat_config | 213 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma... | found_substrings | assert | variable | spacy_llm/tests/tasks/legacy/test_spancat.py | test_ensure_offsets_correspond_to_substrings | 166 | null | |
explosion/spacy-llm | import json
from pathlib import Path
from typing import Iterable
import pytest
import spacy
import srsly
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader, lowercase_... | 2 | assert | numeric_literal | spacy_llm/tests/tasks/test_textcat.py | test_add_label | 849 | null | |
explosion/spacy-llm | import json
import re
from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader... | offsets | assert | variable | spacy_llm/tests/tasks/legacy/test_ner.py | test_ensure_offsets_correspond_to_substrings | 296 | null | |
explosion/spacy-llm | import copy
import pytest
import spacy
from confection import Config # type: ignore[import]
from thinc.compat import has_torch_cuda_gpu
from ...compat import torch
_PIPE_CFG = {
"model": {
"@llm_models": "spacy.Mistral.v1",
"name": "Mistral-7B-v0.1",
},
"task": {"@llm_tasks": "spacy.NoOp... | ["llm"] | assert | collection | spacy_llm/tests/models/test_mistral.py | test_init_from_config | 56 | null | |
explosion/spacy-llm | import json
from pathlib import Path
import pytest
from confection import Config
from pytest import FixtureRequest
from spacy.tokens import Doc, Span
from spacy.training import Example
from spacy.util import get_lang_class
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.tasks.rel import DEFAULT_REL_TEMPLATE,... | len(examples) | assert | func_call | spacy_llm/tests/tasks/test_rel.py | test_rel_init | 198 | null | |
explosion/spacy-llm | import logging
import sys
import warnings
from pathlib import Path
from typing import Any, Dict, Iterable, Optional, Tuple
import pytest
import spacy
import srsly
from confection import Config
from spacy.language import Language
from spacy.tokens import Doc
from spacy.util import make_tempdir
from thinc.api import Num... | captured.out | assert | complex_expr | spacy_llm/tests/pipeline/test_llm.py | test_llm_logs_default_null_handler | 246 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma... | ["llm"] | assert | collection | spacy_llm/tests/tasks/legacy/test_spancat.py | test_spancat_config | 84 | null | |
explosion/spacy-llm | import json
import re
from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader... | 0 | assert | numeric_literal | spacy_llm/tests/tasks/legacy/test_ner.py | test_ner_io | 261 | null | |
explosion/spacy-llm | import re
from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader
from spacy_llm.ty import ShardingLLMTask
from spacy_llm.util import assemble_from_config
... | orig_config["components"]["llm"]["task"]["max_n_words"] * 1.5 | assert | complex_expr | spacy_llm/tests/tasks/test_summarization.py | test_summarization_predict | 193 | null | |
explosion/spacy-llm | import json
import re
from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
import srsly
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.co... | ["llm"] | assert | collection | spacy_llm/tests/tasks/test_ner.py | test_ner_config | 196 | null | |
explosion/spacy-llm | from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy... | 0 | assert | numeric_literal | spacy_llm/tests/tasks/test_spancat.py | test_spancat_predict | 170 | null | |
explosion/spacy-llm | from pathlib import Path
import numpy
import pytest
import spacy
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task
from ..compat import has_openai_key
EXAMPLES_DIR =... | 0.0 | assert | numeric_literal | spacy_llm/tests/tasks/test_sentiment.py | test_sentiment_predict | 134 | null | |
explosion/spacy-llm | from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy... | n_prompt_examples | assert | variable | spacy_llm/tests/tasks/test_spancat.py | test_spancat_init | 595 | null | |
explosion/spacy-llm | import numbers
from pathlib import Path
import pytest
from confection import Config
from spacy.pipeline import EntityLinker
from spacy.tokens import Span
from spacy_llm.tests.compat import has_openai_key
from spacy_llm.util import assemble_from_config
from .util import ShardingCountTask # noqa: F401
_CONTEXT_LENGT... | doc.user_data["count"] | assert | complex_expr | spacy_llm/tests/sharding/test_sharding.py | test_sharding_count | 65 | null | |
explosion/spacy-llm | from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy... | task.labels | assert | complex_expr | spacy_llm/tests/tasks/test_spancat.py | test_spancat_config | 158 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task, make_translation_task
from ..compat import has_openai_key
EXAMPLES_DIR = Path(__file__).parent / ... | f""" Translate the text after "Text:" to Spanish. Respond after "Translation:" with nothing but the translated text. Text: {text} Translation:""".strip() | assert | string_literal | spacy_llm/tests/tasks/test_translation.py | test_jinja_template_rendering_without_examples | 197 | null | |
explosion/spacy-llm | import copy
import pytest
import spacy
from confection import Config # type: ignore[import]
from thinc.compat import has_torch_cuda_gpu
from ...compat import torch
_PIPE_CFG = {
"model": {
"@llm_models": "spacy.Llama2.v1",
"name": "Llama-2-7b-hf",
},
"task": {"@llm_tasks": "spacy.NoOp.v1... | ValueError, match="unexpected value; permitted") | pytest.raises | complex_expr | spacy_llm/tests/models/test_llama2.py | test_invalid_model | 72 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma... | ValueError) | pytest.raises | variable | spacy_llm/tests/tasks/legacy/test_spancat.py | test_example_not_following_basemodel | 483 | null | |
explosion/spacy-llm | import json
import re
from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader... | ["llm"] | assert | collection | spacy_llm/tests/tasks/legacy/test_ner.py | test_ner_config | 186 | null | |
explosion/spacy-llm | import logging
import sys
import warnings
from pathlib import Path
from typing import Any, Dict, Iterable, Optional, Tuple
import pytest
import spacy
import srsly
from confection import Config
from spacy.language import Language
from spacy.tokens import Doc
from spacy.util import make_tempdir
from thinc.api import Num... | texts | assert | variable | spacy_llm/tests/pipeline/test_llm.py | test_llm_pipe_with_cache | 113 | null | |
explosion/spacy-llm | import pytest
from spacy_llm.models.rest.palm import palm_bison
from ..compat import has_palm_key
@pytest.mark.external
@pytest.mark.skipif(has_palm_key is False, reason="PaLM API key not available")
def test_palm_api_response_when_error():
"""Ensure graceful handling of error in the PaLM model."""
# Incorre... | ValueError, match="Request to PaLM API failed:") | pytest.raises | complex_expr | spacy_llm/tests/models/test_palm.py | test_palm_api_response_when_error | 50 | null | |
explosion/spacy-llm | import numbers
from pathlib import Path
import pytest
from confection import Config
from spacy.pipeline import EntityLinker
from spacy.tokens import Span
from spacy_llm.tests.compat import has_openai_key
from spacy_llm.util import assemble_from_config
from .util import ShardingCountTask # noqa: F401
_CONTEXT_LENGT... | ["Alice goes to *Boston* to ", "see the *Boston Celtics* game."] | assert | collection | spacy_llm/tests/sharding/test_sharding.py | test_sharding_entity_linker | 283 | null | |
explosion/spacy-llm | import csv
import functools
from pathlib import Path
import numpy
import pytest
import spacy
import srsly
from confection import Config
from spacy import Vocab
from spacy.kb import InMemoryLookupKB
from spacy.pipeline import EntityLinker
from spacy.tokens import Doc, Span
from spacy.training import Example
from spacy.... | "Q131371" | assert | string_literal | spacy_llm/tests/tasks/test_entity_linker.py | test_entity_linker_predict_no_candidates | 349 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
from thinc.compat import has_torch_cuda_gpu
from spacy_llm import cache # noqa: F401
from spacy_llm.tests.compat import has_openai_key
from .. import el_openai, multitask_openai, ner_dolly, ner_langchain_openai
from .. import ner_v3_openai, rel_openai, textcat_openai
_USAGE_E... | "Q60" | assert | string_literal | usage_examples/tests/test_usage_examples.py | test_el_openai | 35 | null | |
explosion/spacy-llm | import logging
import sys
import warnings
from pathlib import Path
from typing import Any, Dict, Iterable, Optional, Tuple
import pytest
import spacy
import srsly
from confection import Config
from spacy.language import Language
from spacy.tokens import Doc
from spacy.util import make_tempdir
from thinc.api import Num... | 0 | assert | numeric_literal | spacy_llm/tests/pipeline/test_llm.py | test_llm_task_factories_ner | 415 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.registry import file_reader
from spacy_llm.util import assemble_from_config
from ...tasks import RawTask, make_raw_task
from ..compat import has_open... | f""" Text: {text} Reply: """.strip() | assert | string_literal | spacy_llm/tests/tasks/test_raw.py | test_jinja_template_rendering_without_examples | 188 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task, make_translation_task
from ..compat import has_openai_key
EXAMPLES_DIR = Path(__file__).parent / ... | """ Translate the text after "Text:" from English to Spanish. Respond after "Translation:" with nothing but the translated text. Below are some examples (only use these as a guide): Text: Top of the morning to you! Translation: ¡Muy buenos días! Text: The weather is great today. Translation: El clima está fantástico ho... | assert | string_literal | spacy_llm/tests/tasks/test_translation.py | test_jinja_template_rendering_with_examples | 240 | null | |
explosion/spacy-llm | import json
from pathlib import Path
import pytest
from confection import Config
from pytest import FixtureRequest
from spacy.tokens import Doc, Span
from spacy.training import Example
from spacy.util import get_lang_class
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.tasks.rel import DEFAULT_REL_TEMPLATE,... | 0 | assert | numeric_literal | spacy_llm/tests/tasks/test_rel.py | test_incorrect_indexing | 261 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task, make_translation_task
from ..compat import has_openai_key
EXAMPLES_DIR = Path(__file__).parent / ... | "Este es el sol" | assert | string_literal | spacy_llm/tests/tasks/test_translation.py | test_translate_predict | 133 | null | |
explosion/spacy-llm | import pytest
from spacy_llm.models.rest.cohere import Cohere, Endpoints
from ..compat import has_cohere_key
@pytest.mark.external
@pytest.mark.skipif(has_cohere_key is False, reason="Cohere API key not available")
def test_cohere_error_unsupported_model():
"""Ensure graceful handling of error when model is not ... | ValueError, match="model not found") | pytest.raises | complex_expr | spacy_llm/tests/models/test_cohere.py | test_cohere_error_unsupported_model | 87 | null | |
explosion/spacy-llm | import re
from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader
from spacy_llm.ty import ShardingLLMTask
from spacy_llm.util import assemble_from_config
... | ["llm"] | assert | collection | spacy_llm/tests/tasks/test_summarization.py | test_summarization_config | 143 | null | |
explosion/spacy-llm | from typing import Any, Dict
import pytest
import spacy
from thinc.api import NumpyOps, get_current_ops
from spacy_llm.compat import has_langchain
from spacy_llm.pipeline import LLMWrapper
@pytest.mark.external
@pytest.mark.skipif(has_langchain is False, reason="LangChain is not installed")
@pytest.mark.parametrize(... | "llm" | assert | string_literal | spacy_llm/tests/test_combinations.py | test_combinations | 54 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma... | gold_spans | assert | variable | spacy_llm/tests/tasks/legacy/test_spancat.py | test_spancat_zero_shot_task | 206 | null | |
explosion/spacy-llm | import numbers
from pathlib import Path
import pytest
from confection import Config
from spacy.pipeline import EntityLinker
from spacy.tokens import Span
from spacy_llm.tests.compat import has_openai_key
from spacy_llm.util import assemble_from_config
from .util import ShardingCountTask # noqa: F401
_CONTEXT_LENGT... | [ "Do one thing every day that scares you. The", "only thing we have to fear is fear itself.", ] | assert | collection | spacy_llm/tests/sharding/test_sharding.py | test_sharding_translation | 327 | null | |
explosion/spacy-llm | import json
from pathlib import Path
from typing import Iterable
import pytest
import spacy
import srsly
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader, lowercase_... | ["llm"] | assert | collection | spacy_llm/tests/tasks/test_textcat.py | test_textcat_config | 203 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
from thinc.compat import has_torch_cuda_gpu
from spacy_llm import cache # noqa: F401
from spacy_llm.tests.compat import has_openai_key
from .. import el_openai, multitask_openai, ner_dolly, ner_langchain_openai
from .. import ner_v3_openai, rel_openai, textcat_openai
_USAGE_E... | "New York" | assert | string_literal | usage_examples/tests/test_usage_examples.py | test_el_openai | 34 | null | |
explosion/spacy-llm | from pathlib import Path
import numpy
import pytest
import spacy
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task
from ..compat import has_openai_key
EXAMPLES_DIR =... | f""" Analyse whether the text surrounded by ''' is positive or negative. Respond with a float value between 0 and 1. 1 represents an exclusively positive sentiment, 0 an exclusively negative sentiment. Text: ''' {text} ''' Answer:""".strip() | assert | string_literal | spacy_llm/tests/tasks/test_sentiment.py | test_jinja_template_rendering_without_examples | 180 | null | |
explosion/spacy-llm | import numbers
from pathlib import Path
import pytest
from confection import Config
from spacy.pipeline import EntityLinker
from spacy.tokens import Span
from spacy_llm.tests.compat import has_openai_key
from spacy_llm.util import assemble_from_config
from .util import ShardingCountTask # noqa: F401
_CONTEXT_LENGT... | 2 | assert | numeric_literal | spacy_llm/tests/sharding/test_sharding.py | test_sharding_lemma | 88 | null | |
explosion/spacy-llm | from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy... | 0.666666666) | pytest.approx | numeric_literal | spacy_llm/tests/tasks/test_spancat.py | test_spancat_scoring | 553 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task, make_translation_task
from ..compat import has_openai_key
EXAMPLES_DIR = Path(__file__).parent / ... | ["llm"] | assert | collection | spacy_llm/tests/tasks/test_translation.py | test_translation_config | 106 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.registry import file_reader
from spacy_llm.util import assemble_from_config
from ...tasks import RawTask, make_raw_task
from ..compat import has_open... | ["llm"] | assert | collection | spacy_llm/tests/tasks/test_raw.py | test_raw_config | 123 | null | |
explosion/spacy-llm | import copy
import pytest
import spacy
from confection import Config # type: ignore[import]
from thinc.compat import has_torch_cuda_gpu
from ...compat import torch
_PIPE_CFG = {
"model": {
"@llm_models": "spacy.Falcon.v1",
"name": "falcon-rw-1b",
},
"task": {"@llm_tasks": "spacy.NoOp.v1"... | ValueError, match="unexpected value; permitted") | pytest.raises | complex_expr | spacy_llm/tests/models/test_falcon.py | test_invalid_model | 69 | null | |
explosion/spacy-llm | import numbers
from pathlib import Path
import pytest
from confection import Config
from spacy.pipeline import EntityLinker
from spacy.tokens import Span
from spacy_llm.tests.compat import has_openai_key
from spacy_llm.util import assemble_from_config
from .util import ShardingCountTask # noqa: F401
_CONTEXT_LENGT... | [ "Joey[ENT0:PERSON] rents a place in New York City", "[ENT1:GPE], which is in North America[ENT2:LOC].", ] | assert | collection | spacy_llm/tests/sharding/test_sharding.py | test_sharding_rel | 138 | null | |
explosion/spacy-llm | import json
from pathlib import Path
from typing import Iterable
import pytest
import spacy
import srsly
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader, lowercase_... | 1 | assert | numeric_literal | spacy_llm/tests/tasks/test_textcat.py | test_textcat_serde | 814 | null | |
explosion/spacy-llm | import copy
import pytest
import spacy
from confection import Config # type: ignore[import]
from thinc.compat import has_torch_cuda_gpu
from ...compat import torch
_PIPE_CFG = {
"model": {
"@llm_models": "spacy.Mistral.v1",
"name": "Mistral-7B-v0.1",
},
"task": {"@llm_tasks": "spacy.NoOp... | ValueError, match="unexpected value; permitted") | pytest.raises | complex_expr | spacy_llm/tests/models/test_mistral.py | test_invalid_model | 66 | null | |
explosion/spacy-llm | from typing import Tuple
import pytest
import spacy
from thinc.compat import has_torch_cuda_gpu
from spacy_llm.compat import has_accelerate, torch
_PIPE_CFG = {
"model": {
"@llm_models": "",
"name": "",
},
"task": {"@llm_tasks": "spacy.NoOp.v1"},
"save_io": True,
}
@pytest.mark.gpu
@... | ValueError, match="Invalid value float999") | pytest.raises | complex_expr | spacy_llm/tests/models/test_hf.py | test_torch_dtype | 75 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task, make_translation_task
from ..compat import has_openai_key
EXAMPLES_DIR = Path(__file__).parent / ... | "Esto es perfecto." | assert | string_literal | spacy_llm/tests/tasks/test_translation.py | test_translation_io | 161 | null | |
explosion/spacy-llm | import re
import pytest
from spacy_llm.models.rest.anthropic import Anthropic, Endpoints
from ..compat import has_anthropic_key
@pytest.mark.external
@pytest.mark.skipif(has_anthropic_key is False, reason="Anthropic API key unavailable")
def test_anthropic_api_response_is_correct():
"""Check if we're getting th... | 1 | assert | numeric_literal | spacy_llm/tests/models/test_anthropic.py | test_anthropic_api_response_is_correct | 31 | null | |
explosion/spacy-llm | from pathlib import Path
import numpy
import pytest
import spacy
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task
from ..compat import has_openai_key
EXAMPLES_DIR =... | f""" Text: {text} Sentiment: """.strip() | assert | string_literal | spacy_llm/tests/tasks/test_sentiment.py | test_external_template_actually_loads | 261 | null | |
explosion/spacy-llm | import re
from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader
from spacy_llm.ty import ShardingLLMTask
from spacy_llm.util import assemble_from_config
... | 1 | assert | numeric_literal | spacy_llm/tests/tasks/test_summarization.py | test_ner_to_disk | 374 | null | |
explosion/spacy-llm | from pathlib import Path
import numpy
import pytest
import spacy
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task
from ..compat import has_openai_key
EXAMPLES_DIR =... | ["llm"] | assert | collection | spacy_llm/tests/tasks/test_sentiment.py | test_sentiment_config | 105 | null | |
explosion/spacy-llm | import json
import re
from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
import srsly
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.co... | dict() | assert | func_call | spacy_llm/tests/tasks/test_ner.py | test_ner_serde | 784 | null | |
explosion/spacy-llm | import pytest
from spacy_llm.models.rest.cohere import Cohere, Endpoints
from ..compat import has_cohere_key
@pytest.mark.external
@pytest.mark.skipif(has_cohere_key is False, reason="Cohere API key not available")
def test_cohere_api_response_is_correct():
"""Check if we're getting the response from the correct... | 1 | assert | numeric_literal | spacy_llm/tests/models/test_cohere.py | test_cohere_api_response_is_correct | 28 | null | |
explosion/spacy-llm | import json
from pathlib import Path
from typing import Iterable
import pytest
import spacy
import srsly
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader, lowercase_... | dict() | assert | func_call | spacy_llm/tests/tasks/test_textcat.py | test_textcat_serde | 806 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.tokens import Doc
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from spacy_llm.tasks.lemma import LemmaTask
from spacy_llm.util import assemb... | f""" This is a test LEMMA template. Here is the text: {text} """.strip() | assert | string_literal | spacy_llm/tests/tasks/test_lemma.py | test_external_template_actually_loads | 338 | null | |
explosion/spacy-llm | import json
from pathlib import Path
from typing import Iterable
import pytest
import spacy
import srsly
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader, lowercase_... | ValueError) | pytest.raises | variable | spacy_llm/tests/tasks/test_textcat.py | test_example_not_following_basemodel | 579 | null | |
explosion/spacy-llm | import json
from pathlib import Path
from typing import Iterable
import pytest
import spacy
import srsly
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader, lowercase_... | labels | assert | variable | spacy_llm/tests/tasks/test_textcat.py | test_textcat_serde | 805 | null | |
explosion/spacy-llm | import json
import re
from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader... | set() | assert | func_call | spacy_llm/tests/tasks/legacy/test_ner.py | test_ner_init | 758 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma... | len(examples) | assert | func_call | spacy_llm/tests/tasks/legacy/test_spancat.py | test_spancat_init | 576 | null | |
explosion/spacy-llm | import copy
import pytest
import spacy
from confection import Config # type: ignore[import]
from thinc.compat import has_torch_cuda_gpu
from ...compat import torch
_PIPE_CFG = {
"model": {
"@llm_models": "spacy.Llama2.v1",
"name": "Llama-2-7b-hf",
},
"task": {"@llm_tasks": "spacy.NoOp.v1... | ["llm"] | assert | collection | spacy_llm/tests/models/test_llama2.py | test_init_from_config | 61 | null | |
explosion/spacy-llm | from typing import Tuple
import pytest
import spacy
from thinc.compat import has_torch_cuda_gpu
from spacy_llm.compat import has_accelerate, torch
_PIPE_CFG = {
"model": {
"@llm_models": "",
"name": "",
},
"task": {"@llm_tasks": "spacy.NoOp.v1"},
"save_io": True,
}
@pytest.mark.gpu
@... | ImportError, match="requires Accelerate") | pytest.raises | complex_expr | spacy_llm/tests/models/test_hf.py | test_device_config_conflict | 39 | null | |
explosion/spacy-llm | import logging
import sys
import warnings
from pathlib import Path
from typing import Any, Dict, Iterable, Optional, Tuple
import pytest
import spacy
import srsly
from confection import Config
from spacy.language import Language
from spacy.tokens import Doc
from spacy.util import make_tempdir
from thinc.api import Num... | [] | assert | collection | spacy_llm/tests/pipeline/test_llm.py | test_llm_pipe_empty | 123 | null | |
explosion/spacy-llm | import copy
import os
import re
import time
from pathlib import Path
from typing import Dict, Iterable, Optional, Tuple
import pytest
import spacy
import srsly # type: ignore[import]
from spacy.language import Language
from spacy.tokens import Doc, DocBin
from ..cache import BatchCache
from ..registry import registr... | n / 2 | assert | complex_expr | spacy_llm/tests/test_cache.py | test_caching_interrupted | 117 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
import srsly
from confection import Config
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma... | n_detections / 2 | assert | complex_expr | spacy_llm/tests/tasks/legacy/test_spancat.py | test_spancat_scoring | 533 | null | |
explosion/spacy-llm | from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy... | list(task.labels) | assert | func_call | spacy_llm/tests/tasks/test_spancat.py | test_spancat_config | 159 | null | |
explosion/spacy-llm | import json
from pathlib import Path
from typing import Iterable
import pytest
import spacy
import srsly
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.registry import fewshot_reader, file_reader, lowercase_... | 0 | assert | numeric_literal | spacy_llm/tests/tasks/test_textcat.py | test_textcat_predict | 248 | null | |
explosion/spacy-llm | import copy
import os
import re
import time
from pathlib import Path
from typing import Dict, Iterable, Optional, Tuple
import pytest
import spacy
import srsly # type: ignore[import]
from spacy.language import Language
from spacy.tokens import Doc, DocBin
from ..cache import BatchCache
from ..registry import registr... | 0 | assert | numeric_literal | spacy_llm/tests/test_cache.py | test_caching | 58 | null | |
explosion/spacy-llm | from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy... | offsets | assert | variable | spacy_llm/tests/tasks/test_spancat.py | test_ensure_offsets_correspond_to_substrings | 221 | null | |
explosion/spacy-llm | from pathlib import Path
from typing import Callable, List, Tuple, cast
import pytest
import spacy
from confection import Config
from spacy.language import Language
from spacy.tokens import Span
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.pipeline import LLMWrapper
from spacy... | len(examples) | assert | func_call | spacy_llm/tests/tasks/test_spancat.py | test_spancat_init | 593 | null | |
explosion/spacy-llm | import copy
import pytest
import spacy
from confection import Config # type: ignore[import]
from thinc.compat import has_torch_cuda_gpu
from ...compat import torch
_PIPE_CFG = {
"model": {
"@llm_models": "spacy.Dolly.v1",
"name": "dolly-v2-3b",
},
"task": {"@llm_tasks": "spacy.NoOp.v1"},... | ["llm"] | assert | collection | spacy_llm/tests/models/test_dolly.py | test_init_from_config | 59 | null | |
explosion/spacy-llm | import csv
import functools
from pathlib import Path
import numpy
import pytest
import spacy
import srsly
from confection import Config
from spacy import Vocab
from spacy.kb import InMemoryLookupKB
from spacy.pipeline import EntityLinker
from spacy.tokens import Doc, Span
from spacy.training import Example
from spacy.... | 2 | assert | numeric_literal | spacy_llm/tests/tasks/test_entity_linker.py | test_entity_linker_predict_no_candidates | 346 | null | |
explosion/spacy-llm | import copy
import re
from typing import Iterable, Optional, Tuple
import pytest
import spacy
from spacy.tokens import Doc
from ...registry import registry
from ..compat import has_azure_openai_key, has_openai_key
PIPE_CFG = {
"model": {
"@llm_models": "spacy.GPT-3-5.v2",
},
"task": {"@llm_tasks"... | ValueError, match="Could not find function 'spacy.gpt-3.5x.v1'") | pytest.raises | complex_expr | spacy_llm/tests/models/test_rest.py | test_model_error_handling | 56 | null | |
explosion/spacy-llm | from pathlib import Path
import pytest
import spacy
from confection import Config
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task, make_translation_task
from ..compat import has_openai_key
EXAMPLES_DIR = Path(__file__).parent / ... | f""" Translate the text after "Text:" from English to Spanish. Respond after "Translation:" with nothing but the translated text. Text: {text} Translation:""".strip() | assert | string_literal | spacy_llm/tests/tasks/test_translation.py | test_jinja_template_rendering_without_examples | 185 | null | |
explosion/spacy-llm | import logging
import sys
import warnings
from pathlib import Path
from typing import Any, Dict, Iterable, Optional, Tuple
import pytest
import spacy
import srsly
from confection import Config
from spacy.language import Language
from spacy.tokens import Doc
from spacy.util import make_tempdir
from thinc.api import Num... | caplog.text | assert | complex_expr | spacy_llm/tests/pipeline/test_llm.py | test_llm_logs_at_debug_level | 215 | null | |
explosion/spacy-llm | from pathlib import Path
import numpy
import pytest
import spacy
from confection import Config
from spacy.training import Example
from spacy.util import make_tempdir
from spacy_llm.registry import fewshot_reader, file_reader
from ...tasks import make_sentiment_task
from ..compat import has_openai_key
EXAMPLES_DIR =... | 1 | assert | numeric_literal | spacy_llm/tests/tasks/test_sentiment.py | test_sentiment_io | 164 | null | |
explosion/spacy-llm | import json
from pathlib import Path
import pytest
from confection import Config
from pytest import FixtureRequest
from spacy.tokens import Doc, Span
from spacy.training import Example
from spacy.util import get_lang_class
from spacy_llm.pipeline import LLMWrapper
from spacy_llm.tasks.rel import DEFAULT_REL_TEMPLATE,... | set() | assert | func_call | spacy_llm/tests/tasks/test_rel.py | test_rel_init | 185 | null | |
explosion/spacy-llm | import copy
import re
from typing import Iterable, Optional, Tuple
import pytest
import spacy
from spacy.tokens import Doc
from ...registry import registry
from ..compat import has_azure_openai_key, has_openai_key
PIPE_CFG = {
"model": {
"@llm_models": "spacy.GPT-3-5.v2",
},
"task": {"@llm_tasks"... | TimeoutError, match="Request time out. Check your network connection and the API's availability.") | pytest.raises | complex_expr | spacy_llm/tests/models/test_rest.py | test_max_time_error_handling | 95 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.