{"repo":"thoughtbot/ruby_llm-top_secret","free":true,"listed":false,"github":"https://github.com/thoughtbot/ruby_llm-top_secret","clone":"git clone https://github.com/thoughtbot/ruby_llm-top_secret.git","description":"Automatically filter sensitive information from RubyLLM conversations using Top Secret.","language":"Ruby","stars":18,"topics":["anonymization","data-obfuscation","data-privacy","data-redaction","llm-tools","named-entity-recognition","ner","personal-identifiable-information","pii","pii-detection"],"license":"MIT","category":"ai-agents","readme_excerpt":"RubyLLM::TopSecret Filter sensitive information from RubyLLM conversations using Top Secret. Installation Add this line to your application's Gemfile: Then run: Usage Requiring the gem patches RubyLLM::Chat to support filtering sensitive information before it reaches the LLM provider. Filtering is opt-in per conversation using with filtering . Without with filtering , conversations behave normally with no filtering overhead. How it works 1. Wrap your conversation in RubyLLM::TopSecret.with filtering 2. Before sending to the provider, all messages are filtered using TopSecret::Text.filter all 3. The provider only sees placeholders like [PERSON 1] and [EMAIL 1] 4. The response is restored using TopSecret::FilteredText.restore 5. Original message content is always preserved locally Filtering state is thread-isolated, so concurrent requests in a web server won't interfere with each other. Rails integration In Rails apps with acts as chat , declare acts as filtered chat on your model so that filtering works automatically — including from background jobs where a with filtering block isn't possible. Every call to complete on this model will filter automatically. The restored (not filtered) response is what gets saved to your database. [!NOTE] When filtering is active, the assistant message is written to the database twice — once by RubyLLM's built-in callback (with filtered placeholders), and again by this gem (with restored content). This is a known limitation of the current archit","default_branch":null,"files":null,"tree":[],"storefront":"/r/thoughtbot","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/thoughtbot/ruby_llm-top_secret/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}