-
Notifications
You must be signed in to change notification settings - Fork 206
Add Inspeximus document store integration #554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| --- | ||
| layout: integration | ||
| name: Inspeximus | ||
| description: A persistent DocumentStore with a correction channel — supersede, revert, and receipted erasure | ||
| authors: | ||
| - name: Inspeximus | ||
| socials: | ||
| github: DanceNitra | ||
| pypi: https://pypi.org/project/inspeximus/ | ||
| repo: https://github.com/DanceNitra/inspeximus | ||
| type: Document Store | ||
| report_issue: https://github.com/DanceNitra/inspeximus/issues | ||
| version: Haystack 2.0 | ||
| toc: true | ||
| --- | ||
| ### **Table of Contents** | ||
| - [Overview](#overview) | ||
| - [Installation](#installation) | ||
| - [Usage](#usage) | ||
| - [License](#license) | ||
|
|
||
| ## Overview | ||
|
|
||
| [Inspeximus](https://github.com/DanceNitra/inspeximus) is an MIT-licensed, zero-dependency agent-memory | ||
| library. `InspeximusDocumentStore` implements Haystack's `DocumentStore` protocol, so it slots into any | ||
| Haystack pipeline the way `InMemoryDocumentStore` does — with two differences that matter for long-running | ||
| or regulated systems: | ||
|
|
||
| - **It persists.** The store is a file on disk; reopening it returns the same documents, rather than | ||
| starting empty each process. | ||
| - **Its erasure leaves nothing behind.** `erase_documents` removes the value from the bytes on disk, and | ||
| with receipts enabled it writes a signed, content-free tombstone — so a deletion made for a data-subject | ||
| request is provable, not merely done. | ||
|
|
||
| It is a faithful drop-in: duplicate policies (`SKIP`, `OVERWRITE`, `NONE`, `FAIL`) behave exactly as they | ||
| do in `InMemoryDocumentStore`, and filtering reuses Haystack's own `document_matches_filter`, so a | ||
| `FilterRetriever` and pipeline serialization work unchanged. That parity is verified in CI, operation by | ||
| operation, against `InMemoryDocumentStore`, with a falsification control that must fail. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install "inspeximus[haystack]" | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Components | ||
|
|
||
| This integration provides one component: | ||
|
|
||
| - `InspeximusDocumentStore`: a persistent `DocumentStore` you can pass to any store-agnostic retriever | ||
| (for example `FilterRetriever`) or to indexing components (`DocumentWriter`). | ||
|
|
||
| ### Write and retrieve | ||
|
|
||
| ```python | ||
| from haystack import Pipeline | ||
| from haystack.dataclasses import Document | ||
| from haystack.components.retrievers import FilterRetriever | ||
| from haystack.components.writers import DocumentWriter | ||
| from inspeximus.integrations.haystack import InspeximusDocumentStore | ||
|
|
||
| store = InspeximusDocumentStore(path="documents.json") | ||
|
|
||
| # Index some documents. | ||
| indexing = Pipeline() | ||
| indexing.add_component("writer", DocumentWriter(document_store=store)) | ||
| indexing.run({"writer": {"documents": [ | ||
| Document(content="the invoice is due in March", meta={"kind": "invoice"}), | ||
| Document(content="the manager is Rachel Tseng", meta={"kind": "person"}), | ||
| ]}}) | ||
|
|
||
| # Retrieve with a metadata filter. | ||
| retrieval = Pipeline() | ||
| retrieval.add_component("retriever", FilterRetriever(document_store=store)) | ||
| result = retrieval.run({"retriever": { | ||
| "filters": {"field": "meta.kind", "operator": "==", "value": "invoice"} | ||
| }}) | ||
| print([d.content for d in result["retriever"]["documents"]]) | ||
| # ['the invoice is due in March'] | ||
| ``` | ||
|
|
||
| ### Provable erasure | ||
|
|
||
| ```python | ||
| # Remove a document and get back the erasure record; with receipts enabled it is a signed tombstone. | ||
| store.erase_documents(["<document-id>"], request_id="dsr-2026-04-01") | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| `inspeximus` is distributed under the MIT license. | ||
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.
Uh oh!
There was an error while loading. Please reload this page.