Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ jobs:
- name: Install Dependencies
# TODO: fix errors so that we can run `make dev` instead
run: |
# Setup Virtual Environment
python3 -m venv ./.venv
source .venv/bin/activate
make full

- name: Lint with ruff
run: |
source .venv/bin/activate
make lint

Typing:
Expand All @@ -58,10 +62,14 @@ jobs:
- name: Install Dependencies
# TODO: fix errors so that we can run `make dev` instead
run: |
# Setup Virtual Environment
python3 -m venv ./.venv
source .venv/bin/activate
make full

- name: Static analysis with pyright
run: |
source .venv/bin/activate
make type

Pytests:
Expand All @@ -78,7 +86,7 @@ jobs:
- name: Create .guardrailsrc
run: |
echo 'id="SYSTEM TESTING"' > ~/.guardrailsrc
echo 'no_metrics=false' >> ~/.guardrailsrc
echo 'enable_metrics=false' >> ~/.guardrailsrc

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand All @@ -90,10 +98,25 @@ jobs:

- name: Install Dependencies
run: |
# Setup Virtual Environment
python3 -m venv ./.venv
source .venv/bin/activate

make full
if [ "${{ matrix.python-version }}" == "3.12" ]; then
echo "Installing latest langchain-core and langsmith from PyPI"
pip install "langchain-core>=0.2" "langsmith<0.2.0,>=0.1.75"
fi

- name: Run Pytests
run: |
source .venv/bin/activate

echo "langchain-core version:"
pip show langchain-core
echo "langsmith version:"
pip show langsmith

make test-cov

- name: Upload to codecov.io
Expand Down
13 changes: 1 addition & 12 deletions docs/api_reference/data_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,5 @@
::: guardrails.datatypes
options:
filters:
- "!get_validators"
- "!registry"
- "!DataType"
- "!register_type"
- "!Scalar"
- "!set_children"
- "!validate"
- "!from_str"
- "!from_xml"
- "!model"
- "!validators"
- "!to_object_element"
- "!types_registry"
show_bases: true
8 changes: 7 additions & 1 deletion docs/api_reference/guard.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
::: guardrails.guard.Guard
options:
members:
- "__init__"
- "from_rail"
- "from_rail_string"
- "from_pydantic"
- "from_string"
- "use"
- "use_many"
- "to_runnable"
- "configure"
- "__call__"
- "parse"
- "state"
- "validate"
- "history"
- "error_spans_in_output"
13 changes: 0 additions & 13 deletions docs/api_reference/rail.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/api_reference/schema.md

This file was deleted.

197 changes: 101 additions & 96 deletions docs/examples/bug_free_python_code.ipynb

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/examples/check_for_pii.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 1,
"metadata": {},
"outputs": [
{
Expand All @@ -40,7 +40,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -52,7 +52,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -66,7 +66,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -115,7 +115,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -165,7 +165,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -176,7 +176,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 14,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -226,7 +226,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 15,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -292,7 +292,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.0"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down
45 changes: 14 additions & 31 deletions docs/examples/competitors_check.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: nltk in ./.venv/lib/python3.10/site-packages (3.8.1)\n",
"Requirement already satisfied: click in ./.venv/lib/python3.10/site-packages (from nltk) (8.1.7)\n",
"Requirement already satisfied: joblib in ./.venv/lib/python3.10/site-packages (from nltk) (1.4.2)\n",
"Requirement already satisfied: regex>=2021.8.3 in ./.venv/lib/python3.10/site-packages (from nltk) (2023.12.25)\n",
"Requirement already satisfied: tqdm in ./.venv/lib/python3.10/site-packages (from nltk) (4.66.4)\n",
"Requirement already satisfied: nltk in ./.venv/lib/python3.12/site-packages (3.8.1)\n",
"Requirement already satisfied: click in ./.venv/lib/python3.12/site-packages (from nltk) (8.1.7)\n",
"Requirement already satisfied: joblib in ./.venv/lib/python3.12/site-packages (from nltk) (1.4.2)\n",
"Requirement already satisfied: regex>=2021.8.3 in ./.venv/lib/python3.12/site-packages (from nltk) (2023.12.25)\n",
"Requirement already satisfied: tqdm in ./.venv/lib/python3.12/site-packages (from nltk) (4.66.4)\n",
"Installing hub:\u001b[35m/\u001b[0m\u001b[35m/guardrails/\u001b[0m\u001b[95mcompetitor_check...\u001b[0m\n",
"✅Successfully installed guardrails/competitor_check!\n",
"\n",
Expand All @@ -39,32 +39,15 @@
}
],
"source": [
"! pip install nltk\n",
"! pip install nltk --quiet\n",
"! guardrails hub install hub://guardrails/competitor_check --quiet"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/zaydsimjee/workspace/guardrails/docs/examples/.venv/lib/python3.10/site-packages/guardrails/validators/__init__.py:51: FutureWarning: \n",
" Importing validators from `guardrails.validators` is deprecated.\n",
" All validators are now available in the Guardrails Hub. Please install\n",
" and import them from the hub instead. All validators will be\n",
" removed from this module in the next major release.\n",
"\n",
" Install with: `guardrails hub install hub://<namespace>/<validator_name>`\n",
" Import as: from guardrails.hub import `ValidatorName`\n",
" \n",
" warn(\n"
]
}
],
"outputs": [],
"source": [
"from guardrails.hub import CompetitorCheck\n",
"import guardrails as gd\n",
Expand All @@ -89,7 +72,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -123,7 +106,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -158,7 +141,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -230,7 +213,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -325,7 +308,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.0"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down
Loading