Classify how retrieved text supports, partially supports, contradicts, or does not contribute to an answer.
Features · Install · Quick start · Dashboard · Statuses · Development
Features
- Two classification approaches: structured chat-model output and a TypeSafe system-one classifier.
- Traceable results: each result retains the original chunk and its stable identifier.
- Typed data: Pydantic models with frozen attributes validate inputs and outputs.
- Packaged prompts: Markdown and YAML prompt templates are available through Python APIs.
- Optional integrations: install only the provider dependencies you need.
Installation options
The PyPI distribution, Python import package, and GitHub repository are all
named vestigia. Choose the install that matches the integrations you need:
| Configuration | pip command | Includes |
|---|---|---|
| Base | python -m pip install vestigia |
Core models and classifiers |
| OpenAI with LangChain | python -m pip install "vestigia[openai]" |
LangChain OpenAI integration |
| TypeSafe with LangChain | python -m pip install "vestigia[typesafe]" |
TypeSafe classifier and YAML prompt support |
| Anthropic with LangChain | python -m pip install "vestigia[anthropic]" |
LangChain Anthropic integration |
| Dashboard | python -m pip install "vestigia[dashboard]" |
Local Streamlit dashboard and all integrations |
| Everything | python -m pip install "vestigia[all]" |
All optional integrations, including the dashboard |
There is no separate langchain extra: each optional extra installs its
corresponding LangChain integration. With uv or Poetry, replace
python -m pip install with uv add or poetry add.
ChatModelChunkClassifier accepts any LangChain BaseChatModel, so the
openai and anthropic extras are conveniences rather than requirements.
Quick start
Requires Python 3.12 or newer. Install the OpenAI integration with your package manager:
# pip (inside your virtual environment)
python -m pip install "vestigia[openai]"
# uv (in a uv-managed project)
uv add "vestigia[openai]"
# Poetry (in a Poetry-managed project)
poetry add "vestigia[openai]"
Set OPENAI_API_KEY in your environment. Save the following example as
classify.py and run it with python classify.py (or uv run classify.py,
poetry run python classify.py).
This example sends data to the configured provider and may incur API charges.
import asyncio
from langchain_openai import ChatOpenAI
from vestigia.chunk_classification import Chunk
from vestigia.chunk_classification.langchain import ChatModelChunkClassifier
classifier = ChatModelChunkClassifier(
ChatOpenAI(model="gpt-4o-mini"),
)
async def classify_answer():
result = await classifier.classify(
query="What is the repayment term?",
answer="The plan lasts 60 months.",
chunks=[
Chunk(
id="repayment-term",
text="The repayment plan lasts 60 months.",
),
Chunk(
id="early-repayment",
text="Early repayment has no additional fee.",
),
],
)
for item in result.classifications:
print(item.chunk.id, item.status.value, item.explanation)
if __name__ == "__main__":
asyncio.run(classify_answer())
ChatModelChunkClassifier accepts any LangChain BaseChatModel that supports
structured output; the OpenAI integration above is one option.
Use a TypeSafe system-one model
Install the extra with python -m pip install "vestigia[typesafe]"
(uv add or poetry add work the same way) and set TYPESAFE_API_KEY.
Save this example as classify.py and run it with
python classify.py:
import asyncio
from langchain_typesafe import TypeSafeClassifier
from vestigia.chunk_classification import Chunk
from vestigia.chunk_classification.langchain import SystemOneModelChunkClassifier
async def classify_answer():
classifier = SystemOneModelChunkClassifier(TypeSafeClassifier())
result = await classifier.classify(
query="What is the repayment term?",
answer="The plan lasts 60 months.",
chunks=[Chunk(id="source-1", text="The plan lasts 60 months.")],
)
for item in result.classifications:
print(item.chunk.id, item.status.value, item.probabilities, item.confidence)
if __name__ == "__main__":
asyncio.run(classify_answer())
Like the chat-model example, this makes a real provider request. System-one results include per-status probabilities and confidence.
Use the data models directly
The package exports its domain models from vestigia.chunk_classification:
from vestigia.chunk_classification import (
ChatModelChunkClassification,
ChatModelChunksClassificationResult,
Chunk,
ChunkStatus,
)
chunk = Chunk(id="source-1", text="The plan lasts 60 months.")
result = ChatModelChunksClassificationResult(
classifications=(
ChatModelChunkClassification(
chunk=chunk,
status=ChunkStatus.USED,
explanation="The answer states the same repayment term.",
),
)
)
Dashboard
A local browser dashboard runs the classifiers without writing code. It installs every integration:
python -m pip install "vestigia[dashboard]"
vestigia-dashboard
From a clone, run uv run vestigia-dashboard. The dashboard lets you:
- choose an OpenAI-compatible, Anthropic, or TypeSafe model, with optional base
URL and temperature, so local servers such as LM Studio
(
http://localhost:1234/v1) work too; - enter the input, output, and chunks, or import chunks from YAML or JSON as an
ID-to-text mapping, a list of
{id, text}, or a list of strings; blank IDs become1…Nby position; - edit the prompt, including system-one criteria;
- evaluate and review color-coded results per chunk; failures explain what to check (for example an unreachable Base URL or a rejected API key), with the original error under Technical details;
- export the experiment as YAML (model settings, prompt, inputs, chunks, and results) and import it later to restore everything.
To explore the dashboard without a model, choose Import and load
examples/dashboard-experiment.yaml.
It restores the setup and illustrative results shown below:
API keys
Leave the API key field empty to use the provider's environment variable:
| Provider | Environment variable |
|---|---|
| OpenAI-compatible | OPENAI_API_KEY |
| Anthropic | ANTHROPIC_API_KEY |
| TypeSafe | TYPESAFE_API_KEY |
Set it in the shell that starts the dashboard:
export OPENAI_API_KEY="sk-..."
vestigia-dashboard
A key typed into the field overrides the variable for the current browser
session only and is never exported. Local OpenAI-compatible servers such as LM
Studio ignore the key, but the client still requires one, so any placeholder
works: OPENAI_API_KEY=lm-studio vestigia-dashboard.
Classification statuses
| Status | Meaning |
|---|---|
used |
The answer states or faithfully paraphrases meaningful information from the chunk. |
partially_used |
The answer uses meaningful information but omits or incompletely represents other significant details. |
contradicted |
The answer makes a claim incompatible with information in the chunk. |
not_used |
No meaningful information from the chunk appears in the answer, and it is not contradicted. |
uncertain |
The available text does not support a reliable classification. |
Omission alone is not a contradiction. Both packaged prompts instruct the model to assess each chunk against the answer and avoid relying on external knowledge. The labels describe observable overlap and conflict, not proof of the generating model's internal reasoning or actual use of a retrieved chunk.
Classifiers and prompts
| API | Purpose | Optional dependency |
|---|---|---|
ChatModelChunkClassifier |
Classify chunks using a LangChain chat model with structured output. | openai, anthropic, or another installed LangChain chat integration |
SystemOneModelChunkClassifier |
Classify chunks using a TypeSafe system-one model and per-status criteria. | typesafe |
The adapters are exported from vestigia.chunk_classification.langchain.
ChunkClassifier is exported from vestigia.chunk_classification.classifier.
Load the packaged prompt templates directly when needed:
from vestigia.chunk_classification.prompts import (
load_chat_model_prompt,
load_system_one_prompt,
)
chat_prompt_text = load_chat_model_prompt()
system_one_template = load_system_one_prompt()
load_system_one_prompt() requires the typesafe extra, which includes
PyYAML.
Custom prompts
Pass a langchain_core.prompts.PromptTemplate as prompt= to the chat
classifier. Its available variables are query, answer, and chunks; the
last contains XML-escaped source text and identifiers. The model returns only
each chunk's chunk_id, status, and optional explanation; results reference
the original Chunk objects.
For the system-one classifier, pass a SystemOneModelTemplate:
from vestigia.chunk_classification import ChunkStatus, SystemOneModelTemplate
template = SystemOneModelTemplate(
state="Question: {query}\nAnswer: {answer}",
instruction="Evaluate the following evidence: {chunk}",
criteria={
ChunkStatus.USED: "Meaningful information appears in the answer.",
ChunkStatus.NOT_USED: "No meaningful information appears in the answer.",
},
)
The state template receives query and answer; the instruction template
receives each chunk's text as chunk. Criteria require at least two statuses.
Input and output contracts
- Chunk IDs must be unique within each call. Duplicates raise
ValueErrorbefore a provider is invoked. - An empty chunk sequence returns
classifications=()without a provider call. - Results follow input order and contain the original
Chunkobjects. Missing, extra, or duplicate response IDs raiseModelResponseError(fromvestigia.chunk_classification.classifier), aValueErrorsubclass whosemissing,extra, andduplicatesattributes list the offending IDs. - System-one answers must be choice answers whose labels belong to the prompt's
criteria; other answers raise
ModelResponseError. Confidence and probability values must be finite and in[0, 1]. The package does not normalize the distribution or require an exact sum of 1. - Backend, prompt-formatting, and Pydantic validation errors propagate to the caller; the package does not substitute partial or empty success responses.
- Model attributes are frozen and extra fields are rejected. Freezing is shallow: nested dictionaries remain mutable, and normal Pydantic type coercion applies.
Development
Install uv, clone the repository, and install the test and classifier dependencies:
git clone https://github.com/Lorenzo-Gardini/vestigia.git
cd vestigia
uv sync --locked --group dev --all-extras
Run the test suite:
uv run --locked --group dev --all-extras pytest
The tests use real LangChain runnables and TypeSafe response models with mocked providers. They require neither API keys nor network access to a model. Documentation examples are tested without making real provider requests. GitHub Actions runs on pushes and pull requests, checking the base installation, each classifier extra separately, and the combined configuration on Python 3.12. It also builds distributions, validates their metadata and README, and checks imports and packaged resources from an isolated wheel installation.
For architecture and contribution guidance, see AGENTS.md.
License
Licensed under Apache-2.0.
Metadata
Release files for vestigia 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vestigia-1.1.0.tar.gz | 38.0 kB | With provenance | Details for vestigia-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vestigia-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for vestigia-1.1.0-py3-none-any.whl |
Total release size: 79.8 kB
Release files / vestigia-1.1.0.tar.gz
| Download URL | vestigia-1.1.0.tar.gz |
|---|---|
| Size | 38.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1967e0190d5b657d24d06909a45b58a6b2e2a510cc6fef74eea542f39ec33cc2
|
|
BLAKE2b-256 checksum How to use checksums |
f673bab75351813523a106b85c0fbffa91acc2f6d2012336d73ee127f551960e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / vestigia-1.1.0-py3-none-any.whl
| Download URL | vestigia-1.1.0-py3-none-any.whl |
|---|---|
| Size | 41.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38cad0cb6f4412ad81a9eda72aee6bdef0c4d5c0d0af689977ba1e9d42b5e209
|
|
BLAKE2b-256 checksum How to use checksums |
563991c17771a829acad99d2dda85a569cce1cb3356e9c9f34843acc7b2bafa8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for vestigia 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for vestigia-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.