Skip to main content

Dense-retrieval core for JuriCode-JP: artefact loading, query embedding, cosine top-k, and article-level dedup as the single source of truth

Project description

juricode-retrieval

Dense-retrieval core for JuriCode-JP, packaged (MIT) as the single source of truth for the parity-critical primitives.

What it provides

primitive purpose
_load_artefacts Load the embedding matrix (.npy), records (.meta.jsonl), and provider state (.vec.json, .vec.pkl fallback). Missing artefacts fail loudly.
_encode_queries Embed query strings via the artefact's provider (gemini / openai / tfidf). The openai and gemini clients are imported lazily.
_cosine_topk Cosine-similarity top-k of a query matrix against the corpus matrix.
dedup_by_article Collapse duplicate segments of the same article to the top-ranked one.

Why a package

tools/embed/retrieve.py re-imports these four objects, so every eval and service caller runs the identical function objects rather than a copy. The retrieval math is therefore unchanged by construction, and a test asserts the object identity (retrieve._load_artefacts is juricode_retrieval._load_artefacts).

Dependencies

numpy is required (imported lazily inside each primitive, so importing the package itself needs no numpy). google-genai is the production embedding provider; the openai and tfidf branches are optional and imported only when selected.

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

juricode_retrieval-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

juricode_retrieval-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for juricode_retrieval-0.1.0.tar.gz
Algorithm Hash digest
SHA256 32fabf565b2c78db2103f789fac343402bd056417d619dcd4395aefa98086335
MD5 68cf7627a8507a5c485db50652e564e8
BLAKE2b-256 91ca5d5d2d74bfccd2c55710d5cc7092e70892962626ce508a0f330fa5710a54

See more details on using hashes here.

Provenance

The following attestation bundles were made for juricode_retrieval-0.1.0.tar.gz:

Publisher: publish-juricode-retrieval.yml on JuriCode-JP/JuriCode-JP

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

File details

Details for the file juricode_retrieval-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for juricode_retrieval-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48e21d360e0274b55dffff00cb74cad8e4f5cc26f28941b67c643e16717217e6
MD5 23fe7f01c8213baead5e98c0da043aa9
BLAKE2b-256 1f67f905f7184e8ca4793c986310d9c7707c078379903f6cd4f317dfb66b405f

See more details on using hashes here.

Provenance

The following attestation bundles were made for juricode_retrieval-0.1.0-py3-none-any.whl:

Publisher: publish-juricode-retrieval.yml on JuriCode-JP/JuriCode-JP

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