guardrails-ai/contains_string — explained in plain English
Analysis updated 2026-07-25 · repo last pushed 2026-07-25
Ensure AI-generated product descriptions always include a required brand name.
Catch AI outputs that are missing required keywords, codes, or identifiers before they reach a user.
Build layered quality checks on AI-generated text by combining this with other validators.
| guardrails-ai/contains_string | 0xallam/my-recipe | 0xhassaan/nn-from-scratch | |
|---|---|---|---|
| Stars | — | — | 0 |
| Language | Python | Python | Python |
| Last pushed | 2026-07-25 | 2022-11-22 | — |
| Maintenance | Active | Dormant | — |
| Setup difficulty | easy | moderate | moderate |
| Complexity | 2/5 | 2/5 | 4/5 |
| Audience | developer | general | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires installation of the Guardrails AI framework and installing this validator through their hub.
The contains_string validator is a small tool from Guardrails AI that checks whether a piece of text includes a specific substring. Think of it as a quality-control checkpoint: you tell it what word or fragment of text must appear, and it will pass or fail whatever text you feed it based on whether that substring shows up. At a high level, you set up a "guard" and specify two things: the substring you're looking for, and what should happen if the text doesn't contain it. When you then run text through the guard, it checks for that substring. If the substring is there, everything proceeds normally. If it's missing, the guard can respond in different ways, it might throw an error, try to fix the text, filter it out, or simply do nothing, depending on what policy you chose. This is useful for anyone building applications that generate text using AI, especially when certain words or phrases are required in the output. For example, if you have an AI generating product descriptions and every description must mention a brand name, this validator can catch outputs that forgot to include it. It can also be used to make sure generated text contains required keywords, codes, or identifiers before that text reaches a user or gets saved somewhere. The project is built as part of the broader Guardrails AI ecosystem, which provides a collection of validators you can mix and match. You install this particular validator through their hub and combine it with other validators to build layered checks on AI-generated content. The README doesn't go into detail about how the underlying Guardrails framework works, but the validator itself is straightforward, it's a single-purpose check that only cares about whether your target substring exists in the text.
A simple quality-control tool that checks whether a piece of text includes a specific required word or phrase, and takes action if it doesn't. Built for the Guardrails AI ecosystem.
Mainly Python. The stack also includes Python, Guardrails AI.
Active — commit in last 30 days (last push 2026-07-25).
No license information was provided in the repository explanation.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
double-check against the repo, no cap.