Skip to main content

Haystack integration for the .cv open file format.

Project description

cvfile-haystack

Haystack 2.x converter component for the .cv open file format.

A .cv file is a PDF/A-3u file carrying a Markdown copy of the same content (plus optional HTML and JSON Resume) as PDF Associated Files. Instead of OCR ing the PDF, this component reads the embedded text payloads directly and emits Haystack Document objects ready for indexing.

Install

pip install cvfile-haystack

Use

from haystack_integrations.components.converters.cvfile import CVFileToDocument

converter = CVFileToDocument()
result = converter.run(sources=["resume.cv"])
documents = result["documents"]

for doc in documents:
    print(doc.meta["payload"], doc.meta["mime_type"], len(doc.content))

You get one Document per textual payload found in the file. The Markdown copy (typically resume.md) is the one flagged with meta["primary"] = True.

Primary only

If you only want the canonical Markdown copy and want to skip language alternates and supplements:

converter = CVFileToDocument(primary_only=True)

Untrusted files

By default the converter runs cvfile.validate() on every source before extracting anything. Files carrying forbidden active content (JavaScript, launch or submit actions, external references), encryption, integrity digest mismatches, or payloads over the spec size cap make run() raise ValueError listing the issue codes. Resumes are classic untrusted input, so keep the default when converting files you did not produce yourself.

converter = CVFileToDocument()              # verify=True (default)
converter = CVFileToDocument(verify=False)  # trusted files only

Pipeline use

from haystack import Pipeline
from haystack.components.embedders import SentenceTransformersDocumentEmbedder
from haystack.components.writers import DocumentWriter
from haystack.document_stores.in_memory import InMemoryDocumentStore
from haystack_integrations.components.converters.cvfile import CVFileToDocument

store = InMemoryDocumentStore()
pipe = Pipeline()
pipe.add_component("read", CVFileToDocument(primary_only=True))
pipe.add_component("embed", SentenceTransformersDocumentEmbedder(model="BAAI/bge-m3"))
pipe.add_component("write", DocumentWriter(document_store=store))
pipe.connect("read.documents", "embed.documents")
pipe.connect("embed.documents", "write.documents")

pipe.run({"read": {"sources": ["resumes/jane.cv", "resumes/john.cv"]}})

Metadata fields

Key Description
source The file path (or stream name) the document came from
payload Name of the embedded file (e.g. resume.md)
mime_type MIME of the payload (text/markdown, text/html, application/json)
relationship PDF Associated Files relationship (Alternative for primary alternates)
language BCP 47 language tag for this payload
primary True for the payload declared as primary in the file's XMP metadata
cv_version Version of the .cv spec the file conforms to
cv_generator Tool that produced the file, if recorded

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cvfile_haystack-0.3.2.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cvfile_haystack-0.3.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file cvfile_haystack-0.3.2.tar.gz.

File metadata

  • Download URL: cvfile_haystack-0.3.2.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cvfile_haystack-0.3.2.tar.gz
Algorithm Hash digest
SHA256 687e68af34623b4c005bffda3fb016859b5bf63f00c2bf524ddf9968ce565c5b
MD5 2540c631bb05e49069d83d96debaa737
BLAKE2b-256 1d376a2521936e7378c5a62f5316971f58b3988a891707729726c5643f2289da

See more details on using hashes here.

Provenance

The following attestation bundles were made for cvfile_haystack-0.3.2.tar.gz:

Publisher: publish-cvfile-haystack.yml on cvfile/cv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cvfile_haystack-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for cvfile_haystack-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f82416b298a87eba08a8b5f4d27de965ef92dd43dce1bf8c6cc643139e02b20
MD5 e37111cbbd2283b09379222d76242a48
BLAKE2b-256 7a557d1c5c9cdffdedbb853c1e7cc33a6fc2c505251bdc281585a4da2abc735b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cvfile_haystack-0.3.2-py3-none-any.whl:

Publisher: publish-cvfile-haystack.yml on cvfile/cv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page