This release is a pre-release and may not be stable for production use.
persona-lattice
pytest for your user population.
Coverage-based persona testing for conversational AI systems: factorize your simulated users into a lattice of communication style x behavioral disposition x domain, drive every cell against your system, and gate CI on per-cell pass rates.
0.1.0.dev0 — API still settling. Interfaces may change between dev releases; pin exact versions if you depend on this today.
Why
Simulated-user tools exist, but they score one scenario at a time. What they leave open is coverage semantics: a factorized population, balanced cell assignment with synthetic backfill, bidirectional expectations (attack cells must trigger defenses; benign cells carry false-positive budgets), pluggable product-side oracles instead of judge-only scoring, and per-cell regression reporting built for CI.
Install
pip install persona-lattice # core
pip install 'persona-lattice[personahub]' # + PersonaHub corpus sampling
Quickstart
from persona_lattice import Lattice, dispositions, PersonaHubSource
from persona_lattice.llm import OpenAICompatibleClient
from persona_lattice.sut import OpenAICompatibleSUT
from persona_lattice.oracles import GuardrailOracle, LLMJudgeOracle
llm = OpenAICompatibleClient(
base_url="https://api.example.com/v1", api_key="...", model="your-model"
)
lattice = Lattice(
styles=PersonaHubSource(),
dispositions=dispositions.default(), # or a custom subset / your own
domains={"support": SUPPORT_CFG, "sales": SALES_CFG},
affinity={"sales": {"cooperative", "impatient", "adversarial_pricing"}},
)
run = lattice.run(
sut=OpenAICompatibleSUT(llm), # or implement SUTAdapter for your product API
oracles=[GuardrailOracle(false_positive_budget=1), LLMJudgeOracle(llm)],
persona_client=llm,
target_n=120,
seed=42,
workers=8,
)
run.save_report("report.json")
assert run.cell("support", "adversarial_pii").pass_rate >= 0.8 # CI gate
For a zero-network end-to-end demo, run
examples/toy_support_bot.py.
Features
- Coverage lattice — style x disposition x domain with an affinity map for which combinations are valid; seeded round-robin balancing; synthetic-persona backfill so every required cell is always populated.
- 9 built-in dispositions (6 non-cooperative), each carrying its expected outcomes: guardrail triggers, safety gates, sentiment direction, turn bounds.
- Persona sources — inline, JSONL, or seeded sampling from the public PersonaHub corpus; plus an LLM classifier to map corpus personas onto dispositions.
- Pluggable SUT adapters —
CallableSUTfor in-process functions,OpenAICompatibleSUTfor any chat endpoint, or implementSUTAdapteragainst your product's API to surface real guardrail events and halts. - Bidirectional oracles —
GuardrailOracle(attacks must trigger; benign cells get a false-positive budget) andLLMJudgeOracle(sentiment + turn bounds) on a soft-assertion engine (in_range,one_of,at_most). - Parallel runner + reports — thread-pooled execution, a formal JSON report
schema, a self-contained HTML domain x disposition pass-rate heatmap, and
run.cell(...).pass_rateaccessors for CI gates. - Experimental pytest plugin — parametrize tests over lattice cells.
Planned for v0.2: multilingual cells, a simulator-fidelity validator, and report diffing across runs.
License
Apache-2.0 — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file persona_lattice-0.1.0.dev2.tar.gz.
File metadata
- Download URL: persona_lattice-0.1.0.dev2.tar.gz
- Upload date:
- Size: 41.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95740d36219f966fae387dcedcef1cc4ef4d750553a5d2edb46a9f482bf5423a
|
|
| MD5 |
ae640968804a1c0ae5eb727f082c5ff8
|
|
| BLAKE2b-256 |
53766f143023f728b2dd67a77e11aa06e00e485af79bbd1b404f665604862d60
|
Provenance
The following attestation bundles were made for persona_lattice-0.1.0.dev2.tar.gz:
Publisher:
release.yml on yevgenkravets/persona-lattice
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
persona_lattice-0.1.0.dev2.tar.gz -
Subject digest:
95740d36219f966fae387dcedcef1cc4ef4d750553a5d2edb46a9f482bf5423a - Sigstore transparency entry: 2350125735
- Sigstore integration time:
-
Permalink:
yevgenkravets/persona-lattice@b7fd966af4d7c00a93432fd7dd18d5e32d0394c2 -
Branch / Tag:
refs/tags/v0.1.0.dev2 - Owner: https://github.com/yevgenkravets
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7fd966af4d7c00a93432fd7dd18d5e32d0394c2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file persona_lattice-0.1.0.dev2-py3-none-any.whl.
File metadata
- Download URL: persona_lattice-0.1.0.dev2-py3-none-any.whl
- Upload date:
- Size: 32.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f811fe12ca7698c6996f42ba43b423b0c1a0c2a6d0551cf5cfdbaf2b99118ad
|
|
| MD5 |
a77f23e783bbb0cf1a202e3a18cc367d
|
|
| BLAKE2b-256 |
7c3866b860afefa83bc4b9a6a57ff655a99adb6637ae2b1bf1ab72745406eb69
|
Provenance
The following attestation bundles were made for persona_lattice-0.1.0.dev2-py3-none-any.whl:
Publisher:
release.yml on yevgenkravets/persona-lattice
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
persona_lattice-0.1.0.dev2-py3-none-any.whl -
Subject digest:
0f811fe12ca7698c6996f42ba43b423b0c1a0c2a6d0551cf5cfdbaf2b99118ad - Sigstore transparency entry: 2350126535
- Sigstore integration time:
-
Permalink:
yevgenkravets/persona-lattice@b7fd966af4d7c00a93432fd7dd18d5e32d0394c2 -
Branch / Tag:
refs/tags/v0.1.0.dev2 - Owner: https://github.com/yevgenkravets
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b7fd966af4d7c00a93432fd7dd18d5e32d0394c2 -
Trigger Event:
push
-
Statement type: