Skip to content

feat(biome): expose explicit curated knowledge queries - #43

Merged
iihimanshuu merged 1 commit into
hiperhealth:mainfrom
iihimanshuu:feat/hiperhealth-knowledge-queries
Aug 23, 2026
Merged

iihimanshuu merged 1 commit into
hiperhealth:mainfrom
iihimanshuu:feat/hiperhealth-knowledge-queries

Conversation

@iihimanshuu

Copy link
Copy Markdown
Collaborator

Pull Request description

Allow HPHBiomeSkill to execute explicitly requested curated-knowledge queries
through the standalone HPH Biome backend.

This PR:

  • preserves zero-argument HPHBiomeSkill construction;
  • supports optional KnowledgeCollection constructor injection;
  • uses HiperHealth stage-runner kwargs from ctx.extras['_run_kwargs'];
  • requires both hphbiome_query and
    hphbiome_allowed_review_statuses before retrieval runs;
  • supports an optional deterministic hphbiome_limit;
  • delegates retrieval, review-status filtering, result limits, and context
    generation to the standalone hphbiome package;
  • exposes deterministic result dictionaries with record and scientific-reference
    provenance;
  • exposes structured and human-readable traceable context;
  • keeps existing patient-context fields in the HPH Biome stage result;
  • supports both diagnosis and treatment stages consistently;
  • leaves unsupported stages unchanged;
  • preserves existing behavior when no collection is configured;
  • preserves existing behavior when no explicit query or status allowlist is
    supplied;
  • does not derive queries from patient information;
  • does not append retrieved content to prompt fragments automatically;
  • does not generate diagnoses or treatment recommendations;
  • leaves manifests, entry points, dependencies, and the standalone package
    unchanged.

Retrieved knowledge is exposed under:

ctx.results[stage]['hphbiome']['curated_knowledge']

with:

  • results
  • structured_context
  • text_context

Closes #23

How to test these changes

Run the focused adapter and manifest tests:

py -3.13 -m pytest tests/test_hphbiome_hiperhealth.py tests/test_manifests.py -q -p no:xonsh

Run the complete test suite:

py -3.13 -m pytest --cov=hphbiome --cov=hphbiome_hiperhealth --cov-fail-under=92 --cov-report term-missing --no-cov-on-fail -p no:xonsh -q

Run Ruff:

py -3.13 -m ruff check packages tests

Verify formatting:

py -3.13 -m ruff format --check packages tests

Run mypy:

py -3.13 -m mypy packages/hphbiome/src packages/hphbiome-hiperhealth/src

Run pre-commit against the changed files:

py -3.13 -m pre_commit run --files packages/hphbiome-hiperhealth/src/hphbiome_hiperhealth/skill.py tests/test_hphbiome_hiperhealth.py --verbose

Example explicit configuration:

skill = HPHBiomeSkill(collection=collection)

result = runner.run(
    'diagnosis',
    context,
    hphbiome_query='explicit fictional query',
    hphbiome_allowed_review_statuses=['approved-status'],
    hphbiome_limit=3,
)

Reviewer's Checklist

  • I managed to reproduce the problem locally from the main branch
  • I managed to test the new changes locally
  • I confirm that the issues mentioned were fixed/resolved

@iihimanshuu iihimanshuu self-assigned this Aug 23, 2026
@iihimanshuu
iihimanshuu merged commit ffb2a70 into hiperhealth:main Aug 23, 2026
16 checks passed
@iihimanshuu
iihimanshuu deleted the feat/hiperhealth-knowledge-queries branch August 23, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose explicit curated-knowledge queries through HPHBiomeSkill

1 participant