Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Filter sensitive information from free text before sending it to external services or APIs, such as chatbots and LLMs.
| Date | Stars |
|---|---|
| 2026-07-31 | 413 |
| 2026-08-06 | 412 |
Today
-1 stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# Top Secret
[](https://github.com/thoughtbot/top_secret/actions/workflows/main.yml)
Filter sensitive information from free text before sending it to external services or APIs, such as chatbots and LLMs.
By default it filters the following:
- Credit cards
- Emails
- Phone numbers
- Social security numbers
- People's names
- Locations
However, you can add your own [custom filters](#custom-filters).
> [!TIP]
> Using [RubyLLM][]? Check out [ruby_llm-top_secret][] for seamless integration
that automatically filters sensitive information from your prompts before
sending them to LLMs.
## Installation
Install the gem and add to the application's Gemfile by executing:
```bash
bundle add top_secret
```
If bundler is not being used to manage dependencies, install the gem by executing:
```bash
gem install top_secret
```
> [!IMPORTANT]
> Top Secret depends on [MITIE Ruby][], which depends on [MITIE][].
>
> You'll need to download and extract [ner_model.dat][] first.
> [!TIP]
> Due to its large size, you'll likely want to avoid committing [ner_model.dat][] into version control. See the [Production](#production) section for details on using [Trove][] to deploy the model file.
>
> Alternatively, you can disable NER filtering entirely by setting `model_path` to `nil` if you only need regex-based filters (credit cards, emails, phone numbers, SSNs). This improves performance and eliminates the model file dependency.
By default, Top Secret assumes the file will live at the root of your project, but this can be configured.
```ruby
TopSecret.configure do |config|
config.model_path = "path/to/ner_model.dat"
end
```
## Default Filters
Top Secret ships with a set of filters to detect and redact the most common types of sensitive information.
You can [override](#overriding-the-default-filters-1), [disable](#disabling-a-default-filter-1), or [add](#adding-new-default-filters) to this list as needed.
By default, the following filters are enabled
**`credit_card_filter`**
Matches common credit card formats
```ruby
result = TopSecret::Text.filter("My card number is 4242-4242-4242-4242")
result.output
# => "My card number is [CREDIT_CARD_1]"
```
**`email_filter`**
Matches email addresses
```ruby
result = TopSecret::Text.filter("Email me at [email protected]")
result.output
# => "Email me at [EMAIL_1]"
```
**`phone_number_filter`**
Matches phone numbers
```ruby
result = TopSecret::Text.filter("Call me at 555-555-5555")
result.output
# => "Call me at [PHONE_NUMBER_1]"
```
**`ssn_filter`**
Matches U.S. Social Security numbers
```ruby
result = TopSecret::Text.filter("My SSN is 123-45-6789")
result.output
# => "My SSN is [SSN_1]"
```
**`people_filter`**
Detects names of people (NER-based)
```ruby
result = TopSecret::Text.filter("Ralph is joining the meeting")
result.output
# => "[PERSON_1] is joining the meeting"
```
**`location_filter`**
Detects location names (NER-based)
```ruby
result = TopSecret::Text.filter("Let's meet in Boston")
result.output
# => "Let's meet in [LOCATION_1]"
```
## Usage
```ruby
TopSecret::Text.filter("Ralph can be reached at [email protected]")
```
This will return
```ruby
<TopSecret::Text::Result
@input="Ralph can be reached at [email protected]",
@mapping={:EMAIL_1=>"[email protected]", :PERSON_1=>"Ralph"},
@output="[PERSON_1] can be reached at [EMAIL_1]"
>
```
View the original text
```ruby
result.input
# => "Ralph can be reached at [email protected]"
```
View the filtered text
```ruby
result.output
# => "[PERSON_1] can be reached at [EMAIL_1]"
```
View the mapping
```ruby
result.mapping
# => {:EMAIL_1=>"[email protected]", :PERSON_1=>"Ralph"}
```
Check if sensitive information was found
```ruby
result.sensitive?
# => true
result.safe?
# => false
```
### Category Methods
Query the result for specific types of sensitive information usiExcerpt of 24,014 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:5e9f755b5c2b4a92, llm:Repository description: 'Filter sensitive information from free text before sending it to external services or APIs, such as chatbots and LLMs.' Topics include anonymization, data-privacy, pii-detection, ner, llm, ruby.
matched fp:5e9f755b5c2b4a92, llm:Repository description: 'Filter sensitive information from free text before sending it to external services or APIs, such as chatbots and LLMs.' Topics include anonymization, data-privacy, pii-detection, ner, llm, ruby.
matched fp:5e9f755b5c2b4a92, llm:Repository description: 'Filter sensitive information from free text before sending it to external services or APIs, such as chatbots and LLMs.' Topics include anonymization, data-privacy, pii-detection, ner, llm, ruby.