Repository navigation
Closed
Labels
ready-for-agentScoped and ready for a contributor or agent to pick up
Milestone
Description
Parent: #153 · Epic: #126 · Blocked by: #154, #150
Work on branch 153-get-typed-spans-from-the-encoder; commit the changes and close the ticket.
Problem
A typed call is not metered completely and typed spans don't exist in Detection: the typer's work is invisible in usage, and category/subcategory appear only in the old dicts.
Current behavior
- Typing happens in the old
predictpath viaTaxonomyTyper.type_spans(taxonomy_head.py:96) after_build_spans_from_tokens(transformer.py:383); context is the sources joined by newline (or the prompt). Detectionhas no typer usage entry.
Steps
- In
EncoderDetector._detect, when a typer is set, call it for the spans and fillDetectedSpan.categoryandsubcategory; without a typer both areNone. Context: sources joined by"\n"forSourcesInput, the prompt forPromptInput. - Add a second
Usagefor the typer: itsmodel_id,model_version, unitspans(0 when there are no spans). adetecton a typedEncoderDetectorneeds no override: it runsdetect, including the typer call, in one worker thread, so the typed result is the same as the sync one.EncoderDetector.from_pretrained(taxonomy_head=..., include_taxonomy=...)builds the typer throughTaxonomyTyper.from_pretrained, all fourinclude_taxonomyforms.TransformerDetector(taxonomy_head=...)still types spans; output equals the typed golden fixtures from Pin today's TransformerDetector output with golden fixtures #128.
Acceptance criteria
- With a stub typer every span has
categoryandsubcategory; without one bothNone. -
await adetect(...)on a typedEncoderDetectorequalsdetect: samecategory/subcategoryon every span and the same twousageentries; the loop stays free while it waits. - Two
usageentries with a typer, one without; typer entry reportsspans= 0 when there are none. - Typed golden fixtures and
tests/test_custom_taxonomy_pytest.pypass unchanged. - Contract suite passes for a typed
EncoderDetector; follows CONTRIBUTING "Errors and logging".
Start here
uv run --extra dev pytest tests/test_custom_taxonomy_pytest.py tests/test_golden_transformer_pytest.py -q
Metadata
Metadata
Assignees
Labels
ready-for-agentScoped and ready for a contributor or agent to pick up
Activity
feat: type spans in EncoderDetector.detect and meter the typer (#155)