From 28838677087441c0223bef0f374f7b66f594d473 Mon Sep 17 00:00:00 2001
From: elenasamuylova <67064421+elenasamuylova@users.noreply.github.com>
Date: Tue, 19 Nov 2024 16:37:36 +0000
Subject: [PATCH] Docs: small fixes (#1368)
---
docs/book/examples/tutorial-llm.md | 10 ++++------
docs/book/reference/all-metrics.md | 16 ++++++++--------
docs/book/tests-and-reports/run-tests.md | 2 +-
docs/book/tests-and-reports/text-descriptors.md | 7 ++++---
4 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/docs/book/examples/tutorial-llm.md b/docs/book/examples/tutorial-llm.md
index 4784d4cab5..0c821ca1da 100644
--- a/docs/book/examples/tutorial-llm.md
+++ b/docs/book/examples/tutorial-llm.md
@@ -458,12 +458,10 @@ To compute the Semantic Similarity:
```python
text_evals_report = Report(metrics=[
- ColumnSummaryMetric(
- column_name=SemanticSimilarity(
- display_name="Response-Question Similarity"
- )
- .on(["response", "question"])
- )
+ TextEvals(column_name="response", descriptors=[
+ SemanticSimilarity(with_column="question",
+ display_name="Response-Question Similarity"),
+ ])
])
text_evals_report.run(reference_data=None,
diff --git a/docs/book/reference/all-metrics.md b/docs/book/reference/all-metrics.md
index 35a3d50ba0..9df989790a 100644
--- a/docs/book/reference/all-metrics.md
+++ b/docs/book/reference/all-metrics.md
@@ -274,14 +274,14 @@ Check for regular expression matches.
| **ExcludesWords()**
- Checks if the text excludes all specified words.
- Considers only vocabulary words (from NLTK vocabulary).
- By default, considers inflected and variant forms of the same word.
- Returns True/False for every input.
Example use:
`ExcludesWords(words_list=['buy', 'sell', 'bet']`| **Required:**
`words_list: List[str]`
**Optional:**- `display_name`
- `mode = 'all'` or `'any'`
- `lemmatize = True` or `False`
|
| **ItemMatch()** - Checks whether the text contains **any** (default) or **all** specified items that are specific to each row (represented as tuples)
- Returns True/False for each row.
Example use:
`ItemMatch(with_column="expected")`| **Required:**
`with_column: str`
**Optional:**- `display_name`
- `mode = 'all'` or `'any'`
- `case_sensitive = True` or `False`
|
| **ItemNoMatch()** - Checks whether the text excludes **any** (default) or **all** specified items that are specific to each row (represented as tuples)
- Returns True/False for each row.
Example use:
`ItemMatch(with_column="forbidden")`| **Required:**
`with_column: str`
**Optional:**- `display_name`
- `mode = 'all'` or `'any'`
- `case_sensitive = True` or `False`
|
-| **WordMatch()** - Checks whether the text includes **any** (default) or **all** specified words for each row (represented as tuples).
- Considers only vocabulary words (from NLTK vocabulary).
- By default, considers inflected and variant forms of the same word.
- Returns True/False for every input.
Example use:
`WordMatch(with_column="expected"` | **Required:**
`with_column: str`
**Optional:**- `display_name`
- `mode = 'any'` or `'all'`
- `lemmatize = True` or `False`
|
-| **WordNoMatch()** - Checks whether the text excludes **any** (default) or **all** specified words for each row (represented as tuples).
- Considers only vocabulary words (from NLTK vocabulary).
- By default, considers inflected and variant forms of the same word.
- Returns True/False for every input.
Example use:
`WordMatch(with_column="forbidden"` | **Required:**
`with_column: str`
**Optional:**- `display_name`
- `mode = 'any'` or `'all'`
- `lemmatize = True` or `False`
|
-| **ExactMatch()** - Checks if the text matches between two columns.
- Returns True/False for every input.
Example use:
`ExactMatch(column_name='column_1')`| **Required:**
`with_column`
**Optional:** |
-| **IsValidJSON()** - Checks if the text in a specified column is a valid JSON.
- Returns True/False for every input.
Example use:
`IsValidJSON(column_name='column_1')`| **Required:**
`column_name`
**Optional:** |
-| **JSONSchemaMatch()** - Checks if the text contains a JSON object matching the **expected_schema**. Supports exact (**exact=True**) or minimal (**exact=False**) matching, with optional strict type validation (**validate_types=True**).
- Returns True/False for each row.
Example use:
`JSONSchemaMatch(expected_schema={"name": str, "age": int}, exact_match=False, validate_types=True)`| **Required:**
`expected_schema: Dict[str, type]`
**Optional:**- `exact_match = True` or `False`
- `validate_types = True` or `False`
|
-| **JSONMatch()** - Compares two columns of a dataframe and checks whether the two objects in each row of the dataframe are matching JSON's or not.
- Returns True/False for every input.
Example use:
`JSONMatch(with_column="column_2")`| **Required:**
`with_column : str`
**Optional:**- `display_name`
|
-| **ContainsLink()** - Checks if the text contains at least one valid URL.
- Returns True/False for each row.
Example use:
`ContainsLink(column_name='column_1')`| **Required:**
`column_name: str`
**Optional:** |
-| **IsValidPython()** - Checks if the text is valid Python code without syntax errors.
- Returns True/False for every input.
Example use:
`IsValidPython(column_name='column_1')`| **Required:**
n/a
**Optional:** |
+| **WordMatch()** - Checks whether the text includes **any** (default) or **all** specified words for each row (represented as tuples).
- Considers only vocabulary words (from NLTK vocabulary).
- By default, considers inflected and variant forms of the same word.
- Returns True/False for every input.
Example use:
`WordMatch(with_column="expected")` | **Required:**
`with_column: str`
**Optional:**- `display_name`
- `mode = 'any'` or `'all'`
- `lemmatize = True` or `False`
|
+| **WordNoMatch()** - Checks whether the text excludes **any** (default) or **all** specified words for each row (represented as tuples).
- Considers only vocabulary words (from NLTK vocabulary).
- By default, considers inflected and variant forms of the same word.
- Returns True/False for every input.
Example use:
`WordMatch(with_column="forbidden")` | **Required:**
`with_column: str`
**Optional:**- `display_name`
- `mode = 'any'` or `'all'`
- `lemmatize = True` or `False`
|
+| **ExactMatch()** - Checks if the text matches between two columns.
- Returns True/False for every input.
Example use:
`ExactMatch(with_column='reference')`| **Required:**
`with_column: str`
**Optional:** |
+| **IsValidJSON()** - Checks if the text in a specified column is a valid JSON.
- Returns True/False for every input.
| **Required:** n/a
**Optional:** |
+| **JSONSchemaMatch()** - Checks if the text contains a JSON object matching the expected_schema.
- Supports exact (**exact=True**) or minimal (**exact=False**) matching, with optional strict type validation (**validate_types=True**).
- Returns True/False for each row.
Example use:
`JSONSchemaMatch(expected_schema={"name": str, "age": int}, exact_match=False, validate_types=True)`| **Required:**
`expected_schema: Dict[str, type]`
**Optional:**- `exact_match = True` or `False`
- `validate_types = True` or `False`
|
+| **JSONMatch()** - Compares two columns of a dataframe and checks whether the two objects in each row of the dataframe are matching JSONs or not.
- Returns True/False for every input.
Example use:
`JSONMatch(with_column="column_2")`| **Required:**
`with_column : str`
**Optional:**- `display_name`
|
+| **ContainsLink()** - Checks if the text contains at least one valid URL.
- Returns True/False for each row.
| **Required:** n/a
**Optional:** |
+| **IsValidPython()** - Checks if the text is valid Python code without syntax errors.
- Returns True/False for every input.
| **Required:**
n/a
**Optional:** |
## Descriptors: Text stats
diff --git a/docs/book/tests-and-reports/run-tests.md b/docs/book/tests-and-reports/run-tests.md
index 3ff5283874..c183fba2b1 100644
--- a/docs/book/tests-and-reports/run-tests.md
+++ b/docs/book/tests-and-reports/run-tests.md
@@ -52,7 +52,7 @@ data_quality.run(reference_data=None,
```
{% hint style="info" %}
-**Available Test Presets**. There are others: for example, `DataStabilityTestPreset`, `DataDriftTestPreset` or `RegressionTestPreset`. See all [Presets(../presets/all-presets.md). For interactive preview, check [example notebooks](../examples/examples.md).
+**Available Test Presets**. There are others: for example, `DataStabilityTestPreset`, `DataDriftTestPreset` or `RegressionTestPreset`. See all [Presets](../presets/all-presets.md). For interactive preview, check [example notebooks](../examples/examples.md).
{% endhint %}
To get the visual report with Test results, call the object in Jupyter notebook or Colab:
diff --git a/docs/book/tests-and-reports/text-descriptors.md b/docs/book/tests-and-reports/text-descriptors.md
index ab5f4e2b37..3d80fde7ef 100644
--- a/docs/book/tests-and-reports/text-descriptors.md
+++ b/docs/book/tests-and-reports/text-descriptors.md
@@ -188,7 +188,7 @@ For two-column descriptor like `SemanticSimilarity()`, pass both columns as a li
```python
report = Report(metrics=[
- ColumnSummaryMetric(column_name=SemanticSimilarity().on(["answer", "reference_answer"]))
+ ColumnSummaryMetric(column_name=SemanticSimilarity(with_column="question").on("response"))
])
```
@@ -249,8 +249,9 @@ test_suite = TestSuite(tests=[
test_suite = TestSuite(tests=[
TestColumnValueMin(
column_name=SemanticSimilarity(
- display_name="Response Similarity").
- on(["target_response", "new_response"]),
+ display_name="Response Similarity",
+ with_column="target_response").
+ on("new_response"),
gte=0.9),
])
```