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)

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.1.0.tar.gz (4.7 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.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cvfile_haystack-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 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.1.0.tar.gz
Algorithm Hash digest
SHA256 ccc6b38349df78108cbc9264362c4bb7ebf6ff96c856541b95154294df7ecc91
MD5 6498878c3ac1e01bb3a150b0442329c0
BLAKE2b-256 c4637fb6bd212b6b7976dd0c3d37d199a544ffab586d0b9b1ad3ee4704f51cfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for cvfile_haystack-0.1.0.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cvfile_haystack-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02217d25ad949f5b4d3f45cb6b70d1fa9046e3d021a4dbf92dbf7fba71c83b33
MD5 a5fa49da12571931f75840d3446ffb0c
BLAKE2b-256 4c4e1a127d4f8a4280253a6d95b9132c41224beb1edfbf7a88a20d68413da912

See more details on using hashes here.

Provenance

The following attestation bundles were made for cvfile_haystack-0.1.0-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