AI Slop Code RIsk Monitor

guardrails-ai/guardrails

Adding guardrails to large language models.

29.7 Elevated pattern signal View on GitHub

Maintenance and Governance Review

This report summarizes scanner evidence for guardrails-ai/guardrails, a Python project with 7,507 GitHub stars. SynthScan examined 52,672 lines of code across 469 source files, recording 1129 pattern matches distributed across 19 syntactic categories. The legacy adjusted pattern signal is 29.7 (Elevated pattern signal); it is not an authorship estimate.

Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.

29.7
Adjusted Signal
29.7
Raw Pattern Score
100%
Time Factor
2026-10-09
Last Push
7.5K
Stars
Python
Language
52.7K
Lines of Code
469
Files
1.1K
Pattern Hits
2026-10-12
Scan Date
0.09
HC Hit Rate

Risk Review · v3

Use each vector to guide manual verification of the underlying findings.

Cognitive Ownership Risk 59.8/100 · HIGH

Can maintainers explain intent, assumptions, and trade-offs? 742 finding(s).

Hallucinated Dependency & Supply Chain Risk 27.8/100 · MEDIUM

Are imports declared and package/API names verified? 242 finding(s).

Agent Over-Engineering Ratio 51.5/100 · HIGH

Are wrappers, guards, and repeated structures necessary? 663 finding(s).

PR Review Velocity Impact 79.3/100 · CRITICAL

Which changes need focused human review? 1129 finding(s).

What These Metrics Mean

Adjusted Signal
Legacy pattern score normalized per 1,000 scanned lines and multiplied by the repository-level time factor. It is not an estimate of AI authorship.
Raw Pattern Score
Sum of severity- and context-weighted pattern findings before applying the time factor.
Time Factor
A coarse multiplier based on repository last-push metadata. It does not identify when individual code was written.
Pattern Hits
Count of configured pattern findings. Review each location and surrounding code before acting.
HC Hit Rate
High- and critical-severity findings per scanned file. Severity is a configured detector weight, not proof of a vulnerability or authorship.
Lines / Files
Scan coverage denominators used by the legacy normalized score.

Pattern-Signal History

This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.

Severity Breakdown

Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.

CRITICAL 1HIGH 43MEDIUM 152LOW 933

Directory Score Breakdown

This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.

Pattern Findings

The scanner identified 1129 distinct pattern matches across 19 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.

Hyper-Verbose Identifiers513 hits · 497 pts
SeverityFileLineSnippetContext
LOWguardrails/validator_base.py47def split_sentence_word_tokenizers_jl_separator(CODE
LOWguardrails/llm_providers.py902def model_is_supported_server_side(CODE
LOWguardrails/document_store.py213 def get_pages_for_for_indexes(self, indexes: List[int]) -> List[Page]:CODE
LOWguardrails/guard.py186 def must_be_valid_json_schema(CODE
LOWguardrails/guard.py1081 def response_format_json_schema(self) -> Dict[str, Any]:CODE
LOWguardrails/guard.py1084 def json_function_calling_tool(CODE
LOW…ails/validator_service/sequential_validator_service.py110 def run_validators_stream_fix(CODE
LOW…ails/validator_service/sequential_validator_service.py259 def run_validators_stream_noop(CODE
LOWguardrails/classes/llm/llm_response.py83 def deserialize_stream_output(cls, stream_output: Any | None) -> Iterator | None:CODE
LOWguardrails/classes/llm/llm_response.py94 def serialize_async_stream_output(CODE
LOWguardrails/classes/llm/llm_response.py112 def deserialize_async_stream_output(CODE
LOWguardrails/classes/history/iteration.py83 def completion_tokens_consumed(self) -> Optional[int]:CODE
LOWguardrails/classes/history/call.py218 def completion_tokens_consumed(self) -> Optional[int]:CODE
LOWguardrails/classes/history/outputs.py60 def deserialize_validation_response(CODE
LOWguardrails/classes/validation/validator_logs.py51 def serialize_validation_result(CODE
LOWguardrails/classes/validation/validator_logs.py60 def deserialize_validation_result(CODE
LOWguardrails/classes/validation/validation_summary.py12 def _generate_summaries_from_validator_logs(CODE
LOWguardrails/classes/validation/validation_summary.py47 def from_validator_logs_only_fails(CODE
LOWguardrails/vectordb/faiss.py82 def similarity_search_vector_with_threshold(CODE
LOWguardrails/vectordb/base.py43 def similarity_search_vector_with_threshold(CODE
LOWguardrails/vectordb/base.py66 def similarity_search_with_threshold(CODE
LOWguardrails/hub_telemetry/hub_tracing.py19def get_guard_call_attributes(CODE
LOWguardrails/hub_telemetry/hub_tracing.py56def get_validator_inference_attributes(CODE
LOWguardrails/hub_telemetry/hub_tracing.py76def get_validator_usage_attributes(CODE
LOWguardrails/formatters/json_formatter.py28def _jsonschema_to_jsonformer(CODE
LOWguardrails/utils/pydantic_utils.py16def convert_pydantic_model_to_openai_fn(CODE
LOWguardrails/utils/validator_utils.py174def verify_metadata_requirements(CODE
LOWguardrails/utils/validator_utils.py187def parse_validator_reference(ref: ValidatorReference) -> Optional[Validator]:CODE
LOWguardrails/utils/structured_data_utils.py21def set_additional_properties_false_iteratively(schema):CODE
LOWguardrails/utils/structured_data_utils.py53def json_function_calling_tool(CODE
LOWguardrails/utils/structured_data_utils.py62def output_format_json_schema(schema: ModelOrListOfModels) -> dict:CODE
LOWguardrails/utils/docs_utils.py24def messages_to_prompt_string(CODE
LOWguardrails/utils/docs_utils.py74 def prompt_template_token_length(self, prompt_template: Prompt) -> int:CODE
LOWguardrails/utils/prompt_utils.py20def prompt_content_for_string_schema(CODE
LOWguardrails/utils/prompt_utils.py44def prompt_content_for_schema(CODE
LOWguardrails/utils/prompt_utils.py55def messages_to_prompt_string(CODE
LOWguardrails/utils/api_utils.py15def extract_serializeable_metadata(metadata: Dict[str, Any]) -> Dict[str, Any]:CODE
LOWguardrails/utils/openai_utils/v1.py71 def construct_nonchat_response(CODE
LOWguardrails/cli/version.py15def version_warnings_if_applicable(console: Console):CODE
LOWguardrails/cli/create.py152def split_and_install_validators(CODE
LOWguardrails/cli/create.py162 def install_local_models_confirm():CODE
LOWguardrails/cli/hub/utils.py52def pip_process_with_custom_exception(CODE
LOW…ls/integrations/llama_index/guardrails_query_engine.py106 def _update_response_metadata(self, validated_output):CODE
LOW⚡…drails/integrations/databricks/ml_flow_instrumentor.py228 def _instrument_stream_runner_step(CODE
LOW⚡…drails/integrations/databricks/ml_flow_instrumentor.py232 def trace_stream_step_wrapper(CODE
LOW⚡…drails/integrations/databricks/ml_flow_instrumentor.py291 def _instrument_async_stream_runner_step(CODE
LOW⚡…drails/integrations/databricks/ml_flow_instrumentor.py295 async def trace_async_stream_step_wrapper(CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py167 async def _async_guard_execute_wrapper(CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py266 def _instrument_async_runner_step(CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py354 def _instrument_async_runner_call(CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py379 def _instrument_validator_validate(CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py445 def _instrument_validator_async_validate(CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py450 async def trace_async_validator_wrapper(*args, **kwargs):CODE
LOWguardrails/schema/rail_schema.py516def build_choice_case_element_from_if(CODE
LOWguardrails/schema/rail_schema.py609def build_choice_case_element_from_discriminator(CODE
LOWguardrails/schema/rail_schema.py903def json_schema_to_rail_output(CODE
LOWguardrails/prompt/base_prompt.py85 def get_format_instructions_idx(self, text: str) -> Optional[int]:CODE
LOWguardrails/actions/reask.py205def get_reask_setup_for_string(CODE
LOWguardrails/actions/reask.py555def sub_reasks_with_fixed_values(value: Any) -> Any:CODE
LOWguardrails/applications/text2sql.py157 def _create_docstore_with_examples(STRING
453 more matches not shown…
Modern AI Meta-Vocabulary116 hits · 299 pts
SeverityFileLineSnippetContext
MEDIUM⚡SECURITY_ADVISORY.md1# Security Advisory: Malicious code in guardrails-ai 0.10.1COMMENT
MEDIUM⚡SECURITY_ADVISORY.md3**Status:** Active. Package quarantined on PyPI. Tracking issue: [#1473](https://github.com/guardrails-ai/guardrails/issCODE
MEDIUM⚡SECURITY_ADVISORY.md3**Status:** Active. Package quarantined on PyPI. Tracking issue: [#1473](https://github.com/guardrails-ai/guardrails/issCODE
MEDIUMSECURITY_ADVISORY.md20### 1. Do not install `guardrails-ai==0.10.1`COMMENT
MEDIUMSECURITY_ADVISORY.md31pip install git+https://github.com/guardrails-ai/guardrails.git@v0.10.0CODE
MEDIUMSECURITY_ADVISORY.md71- Worked with PyPI to lift the quarantine and publish a clean release (tracked in [#1473](https://github.com/guardrails-CODE
MEDIUMSECURITY_ADVISORY.md71- Worked with PyPI to lift the quarantine and publish a clean release (tracked in [#1473](https://github.com/guardrails-CODE
MEDIUM⚡SECURITY_ADVISORY.md84- Tracking issue: [#1473](https://github.com/guardrails-ai/guardrails/issues/1473)CODE
MEDIUM⚡SECURITY_ADVISORY.md84- Tracking issue: [#1473](https://github.com/guardrails-ai/guardrails/issues/1473)CODE
MEDIUM⚡SECURITY_ADVISORY.md85- GHSA: [GHSA-xmpw-2vmm-p4p6](https://github.com/guardrails-ai/guardrails/security/advisories/GHSA-xmpw-2vmm-p4p6)CODE
MEDIUMHUB_UPDATE.md24## 1. Install with `pip` instead of `guardrails hub install`COMMENT
MEDIUMHUB_UPDATE.md28- guardrails hub install hub://guardrails/detect_piiCODE
MEDIUMpyproject.toml13documentation = "https://www.guardrailsai.com/guardrails/docs"CODE
MEDIUM⚡README.md3<img src="https://raw.githubusercontent.com/guardrails-ai/guardrails/main/docs/assets/Guardrails-ai-logo-for-dark-bg.svgCODE
MEDIUM⚡README.md4<img src="https://raw.githubusercontent.com/guardrails-ai/guardrails/main/docs/assets/Guardrails-ai-logo-for-white-bg.svCODE
MEDIUM⚡README.md9![PyPI - Python Version](https://img.shields.io/pypi/pyversions/guardrails-ai)CODE
MEDIUM⚡README.md10[![Downloads](https://static.pepy.tech/badge/guardrails-ai/month)](https://pepy.tech/project/guardrails-ai)CODE
MEDIUM⚡README.md11[![CI](https://github.com/guardrails-ai/guardrails/actions/workflows/ci.yml/badge.svg)](https://github.com/guardrails-aiCODE
MEDIUM⚡README.md12[![codecov](https://codecov.io/gh/guardrails-ai/guardrails/graph/badge.svg?token=CPkjw91Ngo)](https://codecov.io/gh/guarCODE
MEDIUM⚡README.md16[![Static Badge](https://img.shields.io/badge/Docs-blue?link=https%3A%2F%2Fwww.guardrailsai.com%2Fdocs)](https://guardraCODE
MEDIUM⚡README.md18[![Gurubase](https://img.shields.io/badge/Gurubase-Ask%20Guardrails%20Guru-006BFF)](https://gurubase.io/g/guardrails)CODE
MEDIUM⚡README.md23- **[July 6, 2026]** Guardrails validators are moving to standard PyPI packages you install directly with `pip`, and GuaCODE
MEDIUMREADME.md34<img src="https://raw.githubusercontent.com/guardrails-ai/guardrails/main/docs/assets/with_and_without_guardrails.svg" aCODE
MEDIUMREADME.md43<img src="https://raw.githubusercontent.com/guardrails-ai/guardrails/main/docs/assets/guardrails_hub.gif" alt="GuardrailCODE
MEDIUM⚡README.md113 ) # Both the guardrails passCODE
MEDIUM⚡README.md118 ) # Both the guardrails failCODE
MEDIUMREADME.md1793. Create a config: `guardrails create --validators=hub://guardrails/two_words --guard-name=two-word-guard`STRING
MEDIUMREADME.md183# with the guardrails clientSTRING
MEDIUMREADME.md218Yes, Guardrails can be used with proprietary and open-source LLMs. Check out this guide on [how to use Guardrails with aSTRING
MEDIUMREADME.md222Yes, you can create your own validators and contribute them to Guardrails Hub. Check out this guide on [how to create yoSTRING
MEDIUMCONTRIBUTING.md121. Clone the repository: `git clone https://github.com/guardrails-ai/guardrails.git`CODE
MEDIUMCLAUDE.md36make type # pyright guardrails/CODE
MEDIUMguardrails/__init__.py1# Set up __init__.py so that users can do from guardrails import Response, Schema, etc.COMMENT
MEDIUMguardrails/guard.py876 # https://github.com/guardrails-ai/guardrails/pull/525 is mergedCOMMENT
MEDIUMguardrails/guard.py876 # https://github.com/guardrails-ai/guardrails/pull/525 is mergedCOMMENT
MEDIUMguardrails/classes/output_type.py1# TODO: Move this file to guardrails.typesCOMMENT
MEDIUM⚡guardrails/utils/constants.py5# TODO: Move this to guardrails/constants/__init__.pyCOMMENT
MEDIUM⚡guardrails/utils/constants.py10# TODO: Consolidate this and guardrails/utils/prompt_utils.pyCOMMENT
MEDIUM⚡guardrails/utils/constants.py11# into guardrails/utils/templating_utils.pyCOMMENT
MEDIUMguardrails/cli/configure.py130 guardrails hub install hub://guardrails/regex_matchCODE
MEDIUMguardrails/cli/create.py40 " For example hub:template://guardrails/chatbot or hub:template://guardrails/summarizer."CODE
MEDIUMguardrails/cli/hub/create_validator.py20The template repository can be found here: https://github.com/guardrails-ai/validator-templateCODE
MEDIUMguardrails/cli/hub/create_validator.py70 $ guardrails hub install hub://guardrails/${package_name}CODE
MEDIUMguardrails/cli/hub/create_validator.py162 https://github.com/guardrails-ai/validator-template?tab=readme-ov-file#how-to-create-a-guardrails-validatorCODE
MEDIUMguardrails/cli/hub/create_validator.py162 https://github.com/guardrails-ai/validator-template?tab=readme-ov-file#how-to-create-a-guardrails-validatorCODE
MEDIUMguardrails/cli/hub/create_validator.py176 https://github.com/guardrails-ai/validator-templateCODE
MEDIUMguardrails/cli/hub/submit.py47 guardrails hub install hub://guardrails/${package_name}STRING
MEDIUMguardrails/cli/hub/uninstall.py60 help="URI to the package to uninstall. Example: hub://guardrails/regex_match."CODE
MEDIUM⚡guardrails/cli/hub/install.py13# Quick note: This is the command for `guardrails hub install`. We change the name ofCOMMENT
MEDIUM⚡guardrails/cli/hub/install.py16# call install from a script, please consider importing install from guardrails,COMMENT
MEDIUM⚡guardrails/cli/hub/install.py17# not guardrails.cli.hub.install.COMMENT
MEDIUM⚡guardrails/cli/hub/install.py23 help="URIs to the packages to install. Example: hub://guardrails/regex_match hub://guardrails/toxic_language",CODE
MEDIUMguardrails/telemetry/default_otlp_tracer_mod.py67 do that is in our (docs)[https://guardrailsai.com/guardrails/docs/concepts/telemetry]STRING
MEDIUM⚡guardrails/hub/install.py57 >>> RegexMatch = install("hub://guardrails/regex_match").RegexMatchSTRING
MEDIUM⚡guardrails/hub/install.py58 >>> RegexMatch = install("hub://guardrails/regex_match~=1.4").RegexMatchSTRING
MEDIUM⚡guardrails/hub/install.py61 >>> install("hub://guardrails/regex_match>=1.4,==1.*.")STRING
MEDIUM⚡guardrails/hub/validator_package_service.py341 # ``guardrails-ai-<name>`` (e.g. ``guardrails/detect_pii`` ->STRING
MEDIUM⚡guardrails/hub/validator_package_service.py342 # ``guardrails-ai-detect-pii``). The hub namespace component of theSTRING
MEDIUM⚡guardrails/hub/validator_package_service.py343 # validator id is dropped because every guardrails-owned validator nowSTRING
MEDIUM⚡guardrails/hub/validator_package_service.py344 # publishes under the single ``guardrails-ai-*`` dist namespace onSTRING
56 more matches not shown…
Unused Imports188 hits · 188 pts
SeverityFileLineSnippetContext
LOWguardrails/validator_base.py24CODE
LOWguardrails/embedding.py19CODE
LOWguardrails/llm_providers.py270CODE
LOWguardrails/llm_providers.py375CODE
LOWguardrails/__init__.py3CODE
LOWguardrails/__init__.py4CODE
LOWguardrails/__init__.py5CODE
LOWguardrails/__init__.py6CODE
LOWguardrails/__init__.py7CODE
LOWguardrails/__init__.py7CODE
LOWguardrails/__init__.py7CODE
LOWguardrails/__init__.py8CODE
LOWguardrails/__init__.py8CODE
LOWguardrails/__init__.py9CODE
LOWguardrails/__init__.py10CODE
LOWguardrails/__init__.py10CODE
LOWguardrails/__init__.py11CODE
LOWguardrails/__init__.py12CODE
LOWguardrails/__init__.py13CODE
LOWguardrails/__init__.py14CODE
LOWguardrails/types/__init__.py1CODE
LOWguardrails/types/__init__.py2CODE
LOWguardrails/types/__init__.py3CODE
LOWguardrails/types/__init__.py4CODE
LOWguardrails/types/__init__.py4CODE
LOWguardrails/types/__init__.py4CODE
LOWguardrails/types/__init__.py9CODE
LOWguardrails/types/__init__.py10CODE
LOWguardrails/types/__init__.py10CODE
LOWguardrails/types/__init__.py10CODE
LOWguardrails/types/__init__.py10CODE
LOWguardrails/types/__init__.py10CODE
LOWguardrails/types/__init__.py10CODE
LOWguardrails/validator_service/__init__.py15CODE
LOWguardrails/classes/__init__.py1CODE
LOWguardrails/classes/__init__.py2CODE
LOWguardrails/classes/__init__.py3CODE
LOWguardrails/classes/__init__.py4CODE
LOWguardrails/classes/__init__.py4CODE
LOWguardrails/classes/__init__.py4CODE
LOWguardrails/classes/__init__.py4CODE
LOWguardrails/classes/__init__.py10CODE
LOWguardrails/classes/schema/__init__.py1CODE
LOWguardrails/classes/execution/__init__.py1CODE
LOWguardrails/classes/history/iteration.py1CODE
LOWguardrails/classes/history/__init__.py1CODE
LOWguardrails/classes/history/__init__.py2CODE
LOWguardrails/classes/history/__init__.py3CODE
LOWguardrails/classes/history/__init__.py4CODE
LOWguardrails/classes/history/__init__.py5CODE
LOWguardrails/classes/history/inputs.py1CODE
LOWguardrails/classes/history/call_inputs.py1CODE
LOWguardrails/classes/history/call.py1CODE
LOWguardrails/classes/history/outputs.py1CODE
LOWguardrails/classes/generic/async_iterable.py1CODE
LOWguardrails/classes/generic/__init__.py1CODE
LOWguardrails/classes/generic/__init__.py2CODE
LOWguardrails/classes/generic/__init__.py3CODE
LOWguardrails/classes/validation/validation_result.py1CODE
LOWguardrails/classes/validation/validation_result.py5CODE
128 more matches not shown…
Cross-Language Confusion18 hits · 112 pts
SeverityFileLineSnippetContext
HIGHguardrails/async_guard.py231 self.history.push(call_log)CODE
HIGHguardrails/guard.py571 self.history.push(call_log)CODE
HIGHguardrails/run/runner.py232 call_log.iterations.push(iteration)CODE
HIGHguardrails/run/async_stream_runner.py94 call_log.iterations.push(iteration)CODE
HIGHguardrails/run/stream_runner.py92 call_log.iterations.push(iteration)CODE
HIGHguardrails/run/async_runner.py157 call_log.iterations.push(iteration)CODE
HIGH⚡tests/unit_tests/test_guard.py574 guard.history.push(mock_call)CODE
HIGH⚡tests/unit_tests/test_guard.py591 guard.history.push(mock_call)CODE
HIGH⚡tests/unit_tests/test_guard.py717 guard.history.push(call1)CODE
HIGH⚡tests/unit_tests/test_guard.py718 guard.history.push(call2)CODE
HIGH⚡tests/unit_tests/test_guard.py719 guard.history.push(call3)CODE
HIGH⚡tests/unit_tests/classes/generic/test_stack.py38 stack.push(1)CODE
HIGH⚡tests/unit_tests/classes/generic/test_stack.py42 stack.push(2)CODE
HIGH⚡tests/unit_tests/classes/generic/test_stack.py50 stack.push(1)CODE
HIGH⚡tests/unit_tests/classes/generic/test_stack.py54 stack.push(2)CODE
HIGHtests/unit_tests/classes/generic/test_stack.py111 stack.push(1)CODE
HIGH…s/integrations/databricks/test_ml_flow_instrumentor.py383 call.iterations.push(iteration)CODE
HIGH…s/integrations/databricks/test_ml_flow_instrumentor.py475 call.iterations.push(iteration)CODE
Excessive Try-Catch Wrapping83 hits · 89 pts
SeverityFileLineSnippetContext
LOWREADME.md84 except Exception as e:CODE
LOW⚡README.md119 except Exception as e:CODE
LOWguardrails/llm_providers.py620 except Exception as e:CODE
MEDIUMguardrails/llm_providers.py615def __call__(self, *args, **kwargs) -> LLMResponse:CODE
LOWguardrails/guard.py1063 except Exception as e:CODE
LOWguardrails/api_client.py49 except Exception:CODE
LOWguardrails/api_client.py70 except Exception:CODE
LOWguardrails/api_client.py98 except Exception as e:CODE
LOWguardrails/api_client.py113 except Exception as e:CODE
LOWguardrails/types/rail.py43 except Exception:CODE
LOWguardrails/types/primitives.py15 except Exception as e:CODE
LOWguardrails/types/on_fail.py42 except Exception as e:CODE
LOWguardrails/classes/output_type.py24 except Exception:CODE
LOWguardrails/classes/llm/prompt_callable.py35 except Exception as e:CODE
MEDIUMguardrails/classes/llm/prompt_callable.py30def __call__(self, *args, **kwargs) -> LLMResponse:CODE
LOWguardrails/utils/parsing_utils.py277 except Exception:CODE
LOWguardrails/utils/sql_utils.py70 except Exception as ex:CODE
LOWguardrails/utils/sql_utils.py86 except Exception as ex:CODE
LOWguardrails/utils/serialization_utils.py32 except Exception as e:CODE
LOWguardrails/utils/serialization_utils.py58 except Exception as e:CODE
LOWguardrails/utils/safe_get.py13 except Exception as e:CODE
LOW⚡guardrails/utils/casting_utils.py9 except Exception:CODE
LOW⚡guardrails/utils/casting_utils.py17 except Exception:CODE
LOW⚡guardrails/utils/casting_utils.py25 except Exception:CODE
LOWguardrails/cli/configure.py113 except Exception as e:CODE
LOWguardrails/cli/server/hub_client.py75 except Exception as e:CODE
LOWguardrails/cli/server/hub_client.py137 except Exception as e:CODE
LOWguardrails/cli/server/hub_client.py159 except Exception as e:CODE
LOWguardrails/cli/server/hub_client.py177 except Exception as e:CODE
LOWguardrails/cli/server/hub_client.py205 except Exception as e:CODE
MEDIUMguardrails/cli/server/hub_client.py165def get_auth():CODE
LOWguardrails/cli/hub/submit.py57 except Exception as e:CODE
LOWguardrails/cli/hub/deprecation.py23 except Exception:CODE
LOWguardrails/cli/hub/utils.py85 except Exception:CODE
LOWguardrails/cli/hub/utils.py100 except Exception as e:CODE
LOWguardrails/cli/hub/utils.py157 except Exception:CODE
LOWguardrails/cli/hub/utils.py174 except Exception as e:CODE
LOWguardrails/cli/hub/utils.py211 except Exception:CODE
LOWguardrails/cli/hub/utils.py234 except Exception as e:CODE
LOWguardrails/cli/hub/install.py80 except Exception as e:CODE
LOW…ls/integrations/llama_index/guardrails_query_engine.py102 except Exception as e:CODE
LOW…ils/integrations/llama_index/guardrails_chat_engine.py74 except Exception as e:CODE
LOW⚡…drails/integrations/databricks/ml_flow_instrumentor.py221 except Exception as e:CODE
LOW⚡…drails/integrations/databricks/ml_flow_instrumentor.py284 except Exception as e:CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py145 except Exception as e:CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py200 except Exception as e:CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py254 except Exception as e:CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py320 except Exception as e:CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py347 except Exception as e:CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py372 except Exception as e:CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py428 except Exception as e:CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py489 except Exception as e:CODE
LOWguardrails/telemetry/legacy_validator_tracing.py22 except Exception:CODE
LOWguardrails/telemetry/guard_tracing.py202 except Exception as e:STRING
LOWguardrails/telemetry/guard_tracing.py289 except Exception as e:STRING
LOWguardrails/telemetry/validator_tracing.py129 except Exception as e:CODE
LOWguardrails/telemetry/validator_tracing.py196 except Exception as e:CODE
LOWguardrails/telemetry/common.py30 except Exception as e:CODE
LOWguardrails/telemetry/common.py48 except Exception:CODE
LOWguardrails/telemetry/common.py64 except Exception:CODE
23 more matches not shown…
Empty Error Handlers17 hits · 85 pts
SeverityFileLineSnippetContext
HIGHguardrails/llm_providers.py528except ImportError:CODE
HIGHguardrails/llm_providers.py546except ImportError:CODE
HIGHguardrails/llm_providers.py581except ImportError:CODE
HIGHguardrails/llm_providers.py594except ImportError:CODE
HIGHguardrails/llm_providers.py887except ImportError:CODE
HIGHguardrails/llm_providers.py895except ImportError:CODE
HIGHguardrails/llm_providers.py563except ImportError:CODE
HIGHguardrails/llm_providers.py569except ImportError:CODE
HIGHguardrails/document_store.py13except ImportError:CODE
HIGHguardrails/guard.py916except ValidationError:CODE
HIGHguardrails/api_client.py49except Exception:CODE
HIGHguardrails/api_client.py70except Exception:CODE
HIGHguardrails/classes/generic/stack.py31except IndexError:CODE
HIGHguardrails/classes/generic/stack.py59except ValueError:CODE
HIGHguardrails/vectordb/faiss.py10except ImportError:CODE
HIGHguardrails/utils/parsing_utils.py84except json.decoder.JSONDecodeError:CODE
HIGHguardrails/hub/install.py115except AttributeError:CODE
Deep Nesting64 hits · 62 pts
SeverityFileLineSnippetContext
LOWguardrails/merge.py14CODE
LOWguardrails/embedding.py149CODE
LOWguardrails/guard.py884CODE
LOWguardrails/guard.py953CODE
LOWguardrails/api_client.py251CODE
LOW…ails/validator_service/sequential_validator_service.py110CODE
LOW…ails/validator_service/sequential_validator_service.py259CODE
LOW…ails/validator_service/sequential_validator_service.py315CODE
LOWguardrails/classes/rc.py27CODE
LOWguardrails/classes/history/call.py151CODE
LOWguardrails/classes/history/outputs.py119CODE
LOWguardrails/classes/history/outputs.py152CODE
LOWguardrails/classes/generic/default_json_encoder.py8CODE
LOWguardrails/classes/validation/validator_logs.py60CODE
LOWguardrails/hub_telemetry/hub_tracing.py94CODE
LOWguardrails/formatters/json_formatter.py28CODE
LOWguardrails/utils/misc.py13CODE
LOWguardrails/utils/validator_utils.py111CODE
LOWguardrails/utils/structured_data_utils.py21CODE
LOWguardrails/utils/docs_utils.py127CODE
LOWguardrails/utils/parsing_utils.py141CODE
LOWguardrails/utils/parsing_utils.py281CODE
LOWguardrails/utils/serialization_utils.py12CODE
LOWguardrails/utils/serialization_utils.py40CODE
LOWguardrails/utils/openai_utils/streaming_utils.py27CODE
LOWguardrails/cli/create.py20CODE
LOW…ls/integrations/llama_index/guardrails_query_engine.py52CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py228CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py291CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py232CODE
LOW…drails/integrations/databricks/ml_flow_instrumentor.py295CODE
LOWguardrails/schema/pydantic_schema.py30CODE
LOWguardrails/schema/pydantic_schema.py84CODE
LOWguardrails/schema/pydantic_schema.py167CODE
LOWguardrails/schema/rail_schema.py105CODE
LOWguardrails/schema/rail_schema.py653CODE
LOWguardrails/schema/rail_schema.py756CODE
LOWguardrails/schema/rail_schema.py809CODE
LOWguardrails/schema/generator.py96CODE
LOWguardrails/schema/generator.py211CODE
LOWguardrails/actions/refrain.py10CODE
LOWguardrails/actions/filter.py8CODE
LOWguardrails/actions/reask.py130CODE
LOWguardrails/actions/reask.py293CODE
LOWguardrails/actions/reask.py489CODE
LOWguardrails/actions/reask.py584CODE
LOWguardrails/actions/reask.py528CODE
LOWguardrails/actions/reask.py609CODE
LOWguardrails/telemetry/guard_tracing.py137CODE
LOWguardrails/telemetry/guard_tracing.py168CODE
LOWguardrails/telemetry/guard_tracing.py209CODE
LOWguardrails/telemetry/guard_tracing.py241CODE
LOWguardrails/telemetry/open_inference.py49CODE
LOWguardrails/telemetry/common.py35CODE
LOWguardrails/telemetry/common.py52CODE
LOWguardrails/telemetry/common.py177CODE
LOWguardrails/telemetry/runner_tracing.py109CODE
LOWguardrails/telemetry/runner_tracing.py189CODE
LOWguardrails/telemetry/runner_tracing.py279CODE
LOWguardrails/telemetry/runner_tracing.py281CODE
4 more matches not shown…
Self-Referential Comments21 hits · 56 pts
SeverityFileLineSnippetContext
MEDIUMguardrails/classes/schema/processed_schema.py11 """This class is just a container for the various pieces of information weSTRING
MEDIUMguardrails/utils/misc.py32 # Create the artifact dir if it doesn't exist.COMMENT
MEDIUMguardrails/utils/tokenization_utils.py1# This file contains code adapted from the WordTokenizers.jlCOMMENT
MEDIUMguardrails/utils/hub_telemetry_utils.py74 # Create a resourceCOMMENT
MEDIUMguardrails/utils/hub_telemetry_utils.py83 # Create a tracer provider and a processorCOMMENT
MEDIUMguardrails/utils/sql_utils.py107 # Create a nicely formatted schema from the dictionaryCOMMENT
MEDIUMguardrails/applications/text2sql.py110 # Initialize the Guard class.STRING
MEDIUMguardrails/applications/text2sql.py137 # Initialize the Guard classSTRING
MEDIUMguardrails/telemetry/guard_tracing.py151 # Create a new span and link it to the previous spanSTRING
MEDIUMguardrails/telemetry/guard_tracing.py221 # Create a new span and link it to the previous spanSTRING
MEDIUMguardrails/telemetry/common.py71 """This function is designed to ensure that a given OpenTelemetry contextSTRING
MEDIUM⚡tests/unit_tests/test_guard.py560 # Create a mock call with iterationsCOMMENT
MEDIUM⚡tests/unit_tests/test_guard.py587 # Create a mock call that raises AttributeErrorCOMMENT
MEDIUMtests/unit_tests/test_guard.py462 # Create a real Guard to return from the mockCOMMENT
MEDIUMtests/unit_tests/test_guard.py490 # Create a real Guard to return from the mockCOMMENT
MEDIUMtests/unit_tests/utils/openai_utils/test_v1.py444 # Create a custom class for message with controlled attribute accessCOMMENT
MEDIUMtests/unit_tests/utils/openai_utils/test_v1.py550 # Create a custom class for message with controlled attribute accessCOMMENT
MEDIUMtests/unit_tests/cli/server/test_hub_client.py49 # Create a JWT that expires in the futureCOMMENT
MEDIUM⚡tests/unit_tests/cli/hub/test_submit.py22 # Create a temporary file with the package nameCOMMENT
MEDIUMtests/integration_tests/test_guard.py1035 # Create a Guard with a top level list return typeCOMMENT
MEDIUM.github/workflows/cli-compatibility.yml70 # Create a simple RAIL spec for testing validate commandCOMMENT
Fake / Example Data35 hits · 33 pts
SeverityFileLineSnippetContext
LOWtests/unit_tests/test_guard_log.py11 "Lorem ipsum dolor sit amet",CODE
LOWtests/unit_tests/test_guard_log.py11 "Lorem ipsum dolor sit amet",CODE
LOWtests/integration_tests/test_datatypes.py25 guard.parse(llm_output='{"name": "John Doe", "dob": "2021-01-01"}', num_reasks=0)STRING
LOWtests/integration_tests/test_datatypes.py56 llm_output='{"name": "John Doe", "dob": "' + date_string + '"}', num_reasks=0STRING
LOWtests/integration_tests/test_datatypes.py92 llm_output='{"name": "John Doe", "dob": "' + date_string + '"}',STRING
LOWtests/integration_tests/test_guard.py46 <email name="dummy_email" description="Any dummy email" />CODE
LOWtests/integration_tests/test_guard.py76 "dummy_email": "example@example.com",CODE
LOWtests/integration_tests/test_guard.py97 "dummy_email": "example@example.com",CODE
LOW…tegration_tests/test_assets/string/llm_list_output.txt4 {'user_id': 2, 'user_name': 'Jane Doe', 'num_orders': 20, 'last_order_date': '2020-02-01'},CODE
LOW…tegration_tests/test_assets/string/llm_list_output.txt7 {'user_id': 5, 'user_name': 'John Doe', 'num_orders': 50, 'last_order_date': '2020-05-01'},CODE
LOW…integration_tests/test_assets/validators/detect_pii.py20 For example, if the map is {"John Doe": "REDACTED"}, then the text "JohnSTRING
LOW…tion_tests/test_assets/pydantic/llm_output_reask_2.txt4 "name": "John Doe",CODE
LOW…tion_tests/test_assets/pydantic/llm_output_reask_2.txt9 "name": "Jane Doe",CODE
LOW…tion_tests/test_assets/pydantic/llm_output_reask_1.txt4 "name": "John Doe",CODE
LOW…tion_tests/test_assets/pydantic/llm_output_reask_1.txt9 "name": "Jane Doe",CODE
LOW…tests/test_assets/pydantic/llm_output_full_reask_2.txt4 "name": "John Doe",CODE
LOW…tests/test_assets/pydantic/llm_output_full_reask_2.txt9 "name": "Jane Doe",CODE
LOW…tests/test_assets/pydantic/llm_output_full_reask_1.txt4 "name": "John Doe",CODE
LOW…tests/test_assets/pydantic/llm_output_full_reask_1.txt9 "name": "Jane Doe",CODE
LOW…tests/test_assets/pydantic/validated_response_reask.py93 "name": "John Doe",CODE
LOW…tests/test_assets/pydantic/validated_response_reask.py106 {"name": "Jane Doe", "age": 32, "zip_code": "94103"},CODE
LOW…tests/test_assets/pydantic/validated_response_reask.py115 "name": "John Doe",CODE
LOW…tests/test_assets/pydantic/validated_response_reask.py132 {"name": "Jane Doe", "age": 32, "zip_code": "94103"},CODE
LOW…tests/test_assets/pydantic/validated_response_reask.py141 "name": "John Doe",CODE
LOW…tests/test_assets/pydantic/validated_response_reask.py158 {"name": "Jane Doe", "age": 32, "zip_code": "94103"},CODE
LOW…/integration_tests/test_assets/pydantic/llm_output.txt4 "name": "John Doe",CODE
LOW…/integration_tests/test_assets/pydantic/llm_output.txt9 "name": "Jane Doe",CODE
LOW…/test_assets/pydantic/compiled_prompt_full_reask_2.txt7 "name": "John Doe",CODE
LOW…/test_assets/pydantic/compiled_prompt_full_reask_2.txt18 "name": "Jane Doe",CODE
LOW…ntegration_tests/test_assets/pydantic/parsing_reask.py18Lorem ipsum dolor sit amet, consectetur adipiscing elit,CODE
LOW…ntegration_tests/test_assets/pydantic/parsing_reask.py18Lorem ipsum dolor sit amet, consectetur adipiscing elit,CODE
LOW…ntegration_tests/test_assets/pydantic/parsing_reask.py35Lorem ipsum dolor sit amet, consectetur adipiscing elit,CODE
LOW…ntegration_tests/test_assets/pydantic/parsing_reask.py35Lorem ipsum dolor sit amet, consectetur adipiscing elit,CODE
LOW…/test_assets/pydantic/compiled_prompt_full_reask_1.txt7 "name": "John Doe",CODE
LOW…/test_assets/pydantic/compiled_prompt_full_reask_1.txt17 "name": "Jane Doe",CODE
Modern Structural Boilerplate31 hits · 31 pts
SeverityFileLineSnippetContext
LOWguardrails/__init__.py16__all__ = [CODE
LOWguardrails/guard.py219 def _set_num_reasks(self, num_reasks: Optional[int] = None) -> None:CODE
LOWguardrails/types/__init__.py19__all__ = [CODE
LOWguardrails/classes/__init__.py12__all__ = [CODE
LOWguardrails/classes/schema/__init__.py3__all__ = ["ProcessedSchema"]CODE
LOWguardrails/classes/execution/__init__.py3__all__ = ["GuardExecutionOptions"]CODE
LOWguardrails/classes/history/__init__.py7__all__ = ["Call", "Iteration", "Inputs", "Outputs", "CallInputs"]CODE
LOWguardrails/classes/generic/__init__.py5__all__ = ["ArbitraryModel", "Stack", "Serializeable"]CODE
LOWguardrails/remote_inference/__init__.py3__all__ = ["get_use_remote_inference"]CODE
LOWguardrails/vectordb/__init__.py4__all__ = ["VectorDBBase", "Faiss"]CODE
LOWguardrails/stores/context.py10def set_guard_name(guard_name: str) -> None:CODE
LOWguardrails/stores/context.py18def set_call_kwargs(kwargs: Dict[str, Any]) -> None:CODE
LOWguardrails/formatters/__init__.py21__all__ = [CODE
LOWguardrails/utils/__init__.py5__all__ = ["args", "kwargs", "on_fail"]CODE
LOWguardrails/utils/openai_utils/__init__.py4__all__ = [CODE
LOWguardrails/cli/hub/utils.py17logger = logging.getLogger(__name__)CODE
LOWguardrails/integrations/llama_index/__init__.py8__all__ = ["GuardrailsQueryEngine", "GuardrailsChatEngine"]CODE
LOWguardrails/integrations/databricks/__init__.py3__all__ = ["MlFlowInstrumentor"]CODE
LOWguardrails/prompt/__init__.py5__all__ = [CODE
LOWguardrails/actions/__init__.py7__all__ = [CODE
LOWguardrails/actions/reask.py179def update_response_by_path(output: dict, path: List[Any], value: Any) -> None:CODE
LOWguardrails/validators/__init__.py10__all__ = [CODE
LOWguardrails/telemetry/__init__.py23__all__ = [CODE
LOWguardrails/errors/__init__.py22__all__ = ["ValidationError", "UserFacingException"]CODE
LOWguardrails/run/__init__.py7__all__ = [CODE
LOWguardrails/call_tracing/__init__.py12__all__ = ["GuardTraceEntry", "TraceHandler"]CODE
LOW…ration_tests/test_assets/entity_extraction/__init__.py85__all__ = [CODE
LOW…/integration_tests/test_assets/python_rail/__init__.py39__all__ = [CODE
LOWtests/integration_tests/test_assets/string/__init__.py35__all__ = [CODE
LOW…s/integration_tests/test_assets/validators/__init__.py13__all__ = [CODE
LOW…sts/integration_tests/test_assets/pydantic/__init__.py52__all__ = [CODE
Cross-File Repetition6 hits · 30 pts
SeverityFileLineSnippetContext
HIGHguardrails/settings.py0whether to use a local server for running guardrails.STRING
HIGHguardrails/telemetry/default_otlp_tracer_mod.py0whether to use a local server for running guardrails.STRING
HIGH…rdrails/telemetry/default_otel_collector_tracer_mod.py0whether to use a local server for running guardrails.STRING
HIGHtests/integration_tests/test_guard.py0test that the entity extraction works with re-asking.STRING
HIGHtests/integration_tests/test_pydantic.py0test that the entity extraction works with re-asking.STRING
HIGHtests/integration_tests/test_async.py0test that the entity extraction works with re-asking.STRING
Decorative Section Separators8 hits · 26 pts
SeverityFileLineSnippetContext
MEDIUM⚡tests/unit_tests/test_api_client.py204# ─── upsert_guard ─────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/unit_tests/test_api_client.py15# ─── Helpers ──────────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/unit_tests/test_api_client.py112# ─── Init ─────────────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/unit_tests/test_api_client.py306# ─── fetch_guard ──────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/unit_tests/test_api_client.py392# ─── delete_guard ─────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/unit_tests/test_api_client.py463# ─── validate ─────────────────────────────────────────────────────────────────COMMENT
MEDIUMtests/unit_tests/test_api_client.py604# ─── stream_validate ──────────────────────────────────────────────────────────COMMENT
MEDIUMtests/unit_tests/test_api_client.py767# ─── get_history ──────────────────────────────────────────────────────────────COMMENT
Redundant / Tautological Comments7 hits · 12 pts
SeverityFileLineSnippetContext
LOWguardrails/llm_providers.py485 # Check if kwargs stream is passed inCOMMENT
LOWguardrails/guard.py255 # Check if the validator from the referenceCOMMENT
LOW⚡guardrails/utils/parsing_utils.py123 # Check if text is already verifiedCOMMENT
LOW⚡guardrails/utils/parsing_utils.py127 # Check if text is valid JSONCOMMENT
LOW⚡guardrails/utils/parsing_utils.py134 # Check if error is due to missing commaCOMMENT
LOW.github/workflows/scripts/run_notebooks.sh13# Check if the notebook should be processedCOMMENT
LOW…hub/actions/validator_pypi_publish/add_build_prefix.py36 # Check if the [tool.setuptools] section already existsSTRING
Docstring Block Structure2 hits · 10 pts
SeverityFileLineSnippetContext
HIGHguardrails/validator_base.py355Makes a request to the Validator Hub to run a ML based validation model. This request is authed through the hub STRING
HIGHguardrails/hub/install.py44Install a validator package from a hub URI. Args: package_uri (str): The URI of the package to install. STRING
Over-Commented Block10 hits · 10 pts
SeverityFileLineSnippetContext
LOWguardrails/schema/rail_schema.py321COMMENT
LOWguardrails/actions/reask.py101 # raise RuntimeError("FieldReAsk path is None")COMMENT
LOWguardrails/telemetry/guard_tracing.py81 if number_of_reasks is not None:COMMENT
LOWguardrails/telemetry/guard_tracing.py101 # /COMMENT
LOWguardrails/telemetry/guard_tracing.py121 # )COMMENT
LOWtests/unit_tests/actions/test_reask.py581# property = SubElement(non_empty_root, "list", name="dummy")COMMENT
LOWtests/unit_tests/actions/test_reask.py601# fail_results=[FailResult(error_message="child should not be None")], # noqaCOMMENT
LOWtests/integration_tests/test_streaming.py641# pii_entities="pii",COMMENT
LOWtests/integration_tests/test_streaming.py661# model="gpt-4",COMMENT
LOWdocs/pydocs/pydocs_to_md.py121# pydoc.COMMENT
Hallucination Indicators1 hit · 10 pts
SeverityFileLineSnippetContext
CRITICALtests/unit_tests/test_api_client.py223 mc.http.put.return_value.raise_for_status.assert_called_once()CODE
AI Slop Vocabulary3 hits · 8 pts
SeverityFileLineSnippetContext
MEDIUMguardrails/telemetry/legacy_validator_tracing.py27# We want to encourage users to utilize the validator spansCOMMENT
MEDIUMguardrails/telemetry/legacy_validator_tracing.py82# We want to encourage users to utilize the validator spansCOMMENT
LOWtests/integration_tests/test_guard.py1511# the prompt and instructions and just pass in the messages.COMMENT
AI Structural Patterns5 hits · 5 pts
SeverityFileLineSnippetContext
LOWguardrails/guard.py112CODE
LOWguardrails/applications/text2sql.py62CODE
LOWguardrails/telemetry/open_inference.py49CODE
LOWguardrails/run/runner.py81CODE
LOWguardrails/run/async_runner.py30CODE
Overly Generic Function Names1 hit · 2 pts
SeverityFileLineSnippetContext
LOW⚡…/unit_tests/utils/openai_utils/test_streaming_utils.py277 "content": "Here's how to write a function in Python:\n\ndef my_function():\n pass", # noqaCODE