[Integration]: polanon

オープン 初心者向け
#770 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 13 日以内に返信

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
84/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
documentation

調査の方向性

#730 で参照されている既存の統合ページを読み、この issue に記載された polanon の現在のリリース情報とリンクを比較してください。ページを更新して、現在のリリースを説明し、この issue へのリンクを追加してください。ページに提供された詳細が反映され、作成者が予定している PR を作成できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Stage

Ready: integration exists and works, proposing to list it

Integration or project name

polanon

Integration type

Custom Component

Published package or repo (if it exists)

https://pypi.org/project/polanon/ and https://github.com/boromat/polanon

Need or proof of use
  • Published on PyPI under the MIT license. pip install "polanon[haystack]" adds four Haystack 3 components: PolanonDocumentMasker, PolanonQueryMasker, PolanonRestorer and PolanonStreamRestorer. The current release is 0.4.4.
  • examples/haystack_rag.py is a complete indexing and query pipeline that runs offline with Haystack's mock embedder and chat generator. examples/haystack_openai.py is the same pipeline with OpenAI.
  • CI runs on every commit. It runs the component tests and the offline example against the latest Haystack 3 release and against haystack-ai==3.0.0, and type-checks the module with Haystack installed.
  • PolGate, a self-hosted company chat with RAG over attachments, uses the same masking for retrieval without Haystack: index_chunks and mask_query, which PolanonDocumentMasker and PolanonQueryMasker call.
  • The use case is RAG over Polish documents such as contracts, invoices, CVs and customer e-mails. Names, PESEL numbers and addresses must not reach a hosted embedder, a vector store or a model (GDPR), but the reader still gets an answer with the real names in it.
Short description

polanon masks personal data reversibly before text reaches an embedder, a document store or a model. It puts the originals back into the answer, also while the answer streams. It is Polish-first: it validates the checksums of Polish identifiers (PESEL, NIP, REGON, ID card, IBAN) and reads Polish names in all seven grammatical cases.

For retrieval, tokens are computed with HMAC-SHA256 under a secret key. The same person gets the same token in every document and in every question, also when the name is in another grammatical case, so a masked question finds the masked passages. What each token stands for stays in the application's own mapping store, never in a document's content, meta or id.

I tested it on 1,000 Polish texts from ai4privacy's OpenPII that it was never tuned on, against Presidio set up for Polish with the same spaCy model:

polanon Presidio
Values masked whole 72% 66%
Spans masked outside the values 306 2,641

The details are in the benchmarks.

The integration page from #730 is ready; that PR was closed when this process started. Once this is approved, I'll open a PR with the page updated for the current release, linking this issue.

主要言語
Python
スター
114
フォーク
324
平均マージ
7日 2時間
マージ済み PR(30日)
13

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

deepset-ai/haystack-integrations のほかの issue

deepset-ai/haystack-integrations の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。