From ce32138b8abdc79b4314c50d43e617549d02467f Mon Sep 17 00:00:00 2001 From: jonasferoz Date: Wed, 15 May 2024 13:32:31 -0700 Subject: [PATCH 1/3] update format to conform with template --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9faa4ee..ef45c5f 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,34 @@ # Overview | Developed by | Reflex | -| --- | --- | | Date of development | Feb 15, 2024 | | Validator type | Format | -| Blog | - | +| Blog | | | License | Apache 2 | | Input/Output | Output | -# Description +## Description +### Intended Use This validator checks if a string is valid Python syntax by trying to parse the string into an abstract syntax tree. Note that this validator doesn’t check for things such as correct argument names, etc. -## Requirements +### Requirements * Dependencies: - guardrails-ai>=0.4.0 -# Installation +* Foundation model access keys: + - OPENAI_API_KEY + +## Installation ```bash guardrails hub install hub://reflex/valid_python ``` -# Usage Examples +## Usage Examples -## Validating string output via Python +### Validating string output via Python In this example, we apply the validator to a string output generated by an LLM. From 10bad0a65e681950b2cc467f3068cd0c4c36e21f Mon Sep 17 00:00:00 2001 From: jonasferoz Date: Wed, 15 May 2024 16:17:29 -0700 Subject: [PATCH 2/3] remove erroneous requirement --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index ef45c5f..e2fc730 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,6 @@ This validator checks if a string is valid Python syntax by trying to parse the * Dependencies: - guardrails-ai>=0.4.0 -* Foundation model access keys: - - OPENAI_API_KEY - ## Installation ```bash From 5b85eb73d7f509a21bf2405ab4cdd5ff1dd39ad0 Mon Sep 17 00:00:00 2001 From: jonasferoz Date: Tue, 21 May 2024 16:29:49 -0700 Subject: [PATCH 3/3] remove unicode char, unify styling, adjust description --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e2fc730..1f581c4 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ## Description ### Intended Use -This validator checks if a string is valid Python syntax by trying to parse the string into an abstract syntax tree. Note that this validator doesn’t check for things such as correct argument names, etc. +This validator checks whether a string adheres to valid Python syntax by attempting to parse it into an abstract syntax tree. Please note that it does not examine semantic elements such as correct argument names, type correctness, etc. ### Requirements @@ -20,7 +20,7 @@ This validator checks if a string is valid Python syntax by trying to parse the ## Installation ```bash -guardrails hub install hub://reflex/valid_python +$ guardrails hub install hub://reflex/valid_python ``` ## Usage Examples @@ -35,7 +35,9 @@ from guardrails.hub import ValidPython from guardrails import Guard # Setup Guard -guard = Guard().use(ValidPython, on_fail="exception") +guard = Guard().use( + ValidPython, on_fail="exception" +) # Correct python correct_python = """ @@ -78,7 +80,7 @@ Initializes a new instance of the ValidPython class.
-**`validate(self, value, metadata) → ValidationResult`** +**`validate(self, value, metadata) -> ValidationResult`**
    Validates the given `value` using the rules defined in this validator, relying on the `metadata` provided to customize the validation process. This method is automatically invoked by `guard.parse(...)`, ensuring the validation logic is applied to the input data. @@ -88,6 +90,6 @@ Note: 2. When invoking `guard.parse(...)`, ensure to pass the appropriate `metadata` dictionary that includes keys and values required by this validator. If `guard` is associated with multiple validators, combine all necessary metadata into a single dictionary. **Parameters** -- **`value`** *(Any):* The input value to validate. -- **`metadata`** *(dict):* A dictionary containing metadata required for validation. No additional metadata keys are needed for this validator. +- **`value`** *(Any)*: The input value to validate. +- **`metadata`** *(dict)*: A dictionary containing metadata required for validation. No additional metadata keys are needed for this validator.