Add dedicated KeyValueCache documentation page with worked examples#32
Draft
Copilot wants to merge 8 commits into
Draft
Add dedicated KeyValueCache documentation page with worked examples#32Copilot wants to merge 8 commits into
Copilot wants to merge 8 commits into
Conversation
Agent-Logs-Url: https://github.com/terrierteam/pyterrier-caching/sessions/afb73b1a-2c66-450b-9eed-63063eb1ad4f Co-authored-by: cmacdonald <620938+cmacdonald@users.noreply.github.com>
Agent-Logs-Url: https://github.com/terrierteam/pyterrier-caching/sessions/afb73b1a-2c66-450b-9eed-63063eb1ad4f Co-authored-by: cmacdonald <620938+cmacdonald@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add documentation page for KeyValueCache with examples
Add dedicated KeyValueCache documentation page with worked examples
May 8, 2026
cmacdonald
requested changes
May 8, 2026
Agent-Logs-Url: https://github.com/terrierteam/pyterrier-caching/sessions/39c8e26f-db70-489d-ae02-9c25c870eb5d Co-authored-by: cmacdonald <620938+cmacdonald@users.noreply.github.com>
Agent-Logs-Url: https://github.com/terrierteam/pyterrier-caching/sessions/39c8e26f-db70-489d-ae02-9c25c870eb5d Co-authored-by: cmacdonald <620938+cmacdonald@users.noreply.github.com>
Agent-Logs-Url: https://github.com/terrierteam/pyterrier-caching/sessions/39c8e26f-db70-489d-ae02-9c25c870eb5d Co-authored-by: cmacdonald <620938+cmacdonald@users.noreply.github.com>
Agent-Logs-Url: https://github.com/terrierteam/pyterrier-caching/sessions/39c8e26f-db70-489d-ae02-9c25c870eb5d Co-authored-by: cmacdonald <620938+cmacdonald@users.noreply.github.com>
cmacdonald
reviewed
May 8, 2026
| import pyterrier as pt | ||
| from pyterrier_caching import KeyValueCache | ||
|
|
||
| feature_transformer = pt.apply.generic(lambda df: df.assign(feature=1.0)) |
Contributor
There was a problem hiding this comment.
To better match the PyTerrier LTR data model, column should nane be features, not feature.
also the value should be an numpy array, not a single value.
Author
There was a problem hiding this comment.
Implemented in commit 9f174e5: the example now uses features (not feature) and populates it with NumPy arrays (np.array([...], dtype=np.float32)), with value=['features']. Screenshot: updated docs snippet is visible in the PR file diff for key-value-cache.rst.
cmacdonald
requested changes
May 8, 2026
Agent-Logs-Url: https://github.com/terrierteam/pyterrier-caching/sessions/e84fd26a-a8cc-4775-bc0a-ee224b6850f0 Co-authored-by: cmacdonald <620938+cmacdonald@users.noreply.github.com>
cmacdonald
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds first-class documentation for
KeyValueCache, comparable to the existing Scorer/Indexer/Retriever cache docs. It introduces a dedicated page with practical usage patterns and wires it into the main docs navigation.New KeyValueCache docs page
pyterrier_caching/pt_docs/key-value-cache.rst.KeyValueCacheis for (general transformer output caching by key columns),pyterrier_caching.KeyValueCachepyterrier_caching.Sqlite3KeyValueCacheWorked examples
featuresoutput keyed by['query', 'docno'], withfeaturesstored as NumPy array values.pyterrier_caching/pt_docs/index.rstto includekey-value-cachein the toctree and component list.README.mdoverview links to include the new KeyValueCache documentation page.