Skip to main content

placeborag

Deterministic test doubles for the retrieval half of a RAG pipeline.

Existing mock LLM tooling stubs the chat completion endpoint and hands back pseudo-random embedding vectors of the correct shape. Correct shape, no semantic structure. Any document can come back at any rank, so every retrieval assertion in your test suite is decorative: you can assert that the pipeline ran, not that it retrieved the right thing.

placeborag gives you an embedder that is a pure function whose output geometry you can reason about — offline, in microseconds, with no model and no network.

Install

pip install placeborag

Use

from placeborag import FakeEmbedder, cosine_similarity

embedder = FakeEmbedder()

query = embedder.embed("refund policy")
related = embedder.embed("what is your refund policy for orders")
unrelated = embedder.embed("delivery times to remote islands")

assert cosine_similarity(query, related) > cosine_similarity(query, unrelated)

The same text always gives the same vector, so a top-k assertion is stable across runs and across machines:

assert embedder.embed("refund policy") == embedder.embed("refund policy")

Changing model_name changes the embedding space, which is what makes the "we swapped the embedding model and have to reindex" code path testable:

a = FakeEmbedder(model_name="text-embedding-3-small")
b = FakeEmbedder(model_name="text-embedding-3-large")

assert a.embed("refund policy") != b.embed("refund policy")

Every vector is L2-normalized, including for the empty string and for non-ASCII input.

How it works

Character n-grams and word tokens are hashed into dimensions buckets with a signed hashing trick, summed, and normalized. Texts sharing tokens land near each other. There is no training data and no model file — the seed is derived from (text, model_name, dimensions).

That makes the ranking explainable to whoever reads the failing test, which is the part random vectors can never give you.

Status

0.0.1 is deliberately small: the hashing layer of FakeEmbedder and nothing else. It exists to prove the release pipeline.

Next up:

  • declared clusters, so you can steer which texts are near which
  • a fake vector store reproducing real backend score conventions (distance-lower-is-better vs score-higher-is-better) and pre-filter vs post-filter semantics
  • pytest fixtures as a thin layer over the library

What this is not

Not an eval framework, not a benchmark, not a production vector store, and not another OpenAI-compatible mock server.

License

MIT

Download files

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

Source Distribution

placeborag-0.0.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

placeborag-0.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file placeborag-0.0.1.tar.gz.

File metadata

  • Download URL: placeborag-0.0.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for placeborag-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9d5ee1dca62d002ba6b6a5c086efb4fbd40e7d38198af37ea8640ca9ac9a535f
MD5 4fc13da9d33db12deffbbfee8a721533
BLAKE2b-256 519f35e7338fde1487ac9413c2eb7bbc24a3e0332bfed5aa82c10c60de3143a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for placeborag-0.0.1.tar.gz:

Publisher: publish.yml on elaz48/placeborag

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

File details

Details for the file placeborag-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: placeborag-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for placeborag-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d72cd31cdf58c9e533cc2006315103fdc0764c40f8cb2c44ccee00de6c71513d
MD5 62763d5f761fd7a27c79b1cc9cd8a163
BLAKE2b-256 c132cd4a28b88264fe876e6ca7c16ecc6580e2af5c0eea71b9a1f9c16bd0097e

See more details on using hashes here.

Provenance

The following attestation bundles were made for placeborag-0.0.1-py3-none-any.whl:

Publisher: publish.yml on elaz48/placeborag

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 Sentry Error logging StatusPage Status page