Skip to content

Commit

Permalink
Docs: small fixes (#1368)
Browse files Browse the repository at this point in the history
  • Loading branch information
elenasamuylova authored Nov 19, 2024
1 parent 013089f commit 2883867
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
10 changes: 4 additions & 6 deletions docs/book/examples/tutorial-llm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions docs/book/reference/all-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ Check for regular expression matches.
| **ExcludesWords()** <ul><li>Checks if the text excludes all specified words.</li><li> Considers only vocabulary words (from NLTK vocabulary). </li><li>By default, considers inflected and variant forms of the same word. </li><li>Returns True/False for every input. </li></ul> Example use:<br> `ExcludesWords(words_list=['buy', 'sell', 'bet']`| **Required:** <br>`words_list: List[str]` <br><br>**Optional:**<ul><li>`display_name`</li><li>`mode = 'all'` or `'any'`</li><li>`lemmatize = True` or `False`</li></ul> |
| **ItemMatch()** <ul><li>Checks whether the text contains **any** (default) or **all** specified items that are specific to each row (represented as tuples) </li><li>Returns True/False for each row. </li></ul> Example use:<br> `ItemMatch(with_column="expected")`| **Required:** <br>`with_column: str`<br><br>**Optional:**<ul><li>`display_name`</li><li>`mode = 'all'` or `'any'`</li></li><li>`case_sensitive = True` or `False`</li></ul> |
| **ItemNoMatch()** <ul><li>Checks whether the text excludes **any** (default) or **all** specified items that are specific to each row (represented as tuples) </li><li>Returns True/False for each row. </li></ul> Example use:<br> `ItemMatch(with_column="forbidden")`| **Required:** <br>`with_column: str`<br><br>**Optional:**<ul><li>`display_name`</li><li>`mode = 'all'` or `'any'`</li></li><li>`case_sensitive = True` or `False`</li></ul> |
| **WordMatch()** <ul><li> Checks whether the text includes **any** (default) or **all** specified words for each row (represented as tuples). </li><li> Considers only vocabulary words (from NLTK vocabulary). </li><li> By default, considers inflected and variant forms of the same word. </li><li> Returns True/False for every input. </li></ul> Example use:<br> `WordMatch(with_column="expected"` | **Required:** <br> `with_column: str`<br><br>**Optional:**<ul><li>`display_name`</li><li>`mode = 'any'` or `'all'`</li><li>`lemmatize = True` or `False`</li></ul> |
| **WordNoMatch()** <ul><li> Checks whether the text excludes **any** (default) or **all** specified words for each row (represented as tuples). </li><li> Considers only vocabulary words (from NLTK vocabulary). </li><li> By default, considers inflected and variant forms of the same word. </li><li> Returns True/False for every input. </li></ul> Example use:<br> `WordMatch(with_column="forbidden"` | **Required:** <br> `with_column: str`<br><br>**Optional:**<ul><li>`display_name`</li><li>`mode = 'any'` or `'all'`</li><li>`lemmatize = True` or `False`</li></ul> |
| **ExactMatch()** <ul><li>Checks if the text matches between two columns.</li><li>Returns True/False for every input. </li></ul> Example use:<br> `ExactMatch(column_name='column_1')`| **Required:** <br>`with_column` <br><br>**Optional:**<ul><li>`display_name`</li></ul> |
| **IsValidJSON()** <ul><li>Checks if the text in a specified column is a valid JSON.</li><li>Returns True/False for every input. </li></ul> Example use:<br> `IsValidJSON(column_name='column_1')`| **Required:** <br>`column_name` <br><br>**Optional:**<ul><li>`display_name`</li></ul> |
| **JSONSchemaMatch()** <ul><li>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**). </li><li>Returns True/False for each row. </li></ul> Example use:<br> `JSONSchemaMatch(expected_schema={"name": str, "age": int}, exact_match=False, validate_types=True)`| **Required:** <br>`expected_schema: Dict[str, type]`<br><br>**Optional:**<ul><li>`exact_match = True` or `False`</li><li>`validate_types = True` or `False`</li></ul> |
| **JSONMatch()** <ul><li>Compares two columns of a dataframe and checks whether the two objects in each row of the dataframe are matching JSON's or not. </li><li>Returns True/False for every input. </li></ul> Example use:<br> `JSONMatch(with_column="column_2")`| **Required:** <br> `with_column : str` <br><br>**Optional:**<ul><li>`display_name`</li> |
| **ContainsLink()** <ul><li>Checks if the text contains at least one valid URL. </li><li>Returns True/False for each row. </li></ul> Example use:<br> `ContainsLink(column_name='column_1')`| **Required:** <br>`column_name: str`<br><br>**Optional:**<ul><li>`display_name`</li></ul> |
| **IsValidPython()** <ul><li>Checks if the text is valid Python code without syntax errors.</li><li>Returns True/False for every input. </li></ul> Example use:<br> `IsValidPython(column_name='column_1')`| **Required:** <br>n/a<br><br>**Optional:**<ul><li>`display_name`</li></ul> |
| **WordMatch()** <ul><li> Checks whether the text includes **any** (default) or **all** specified words for each row (represented as tuples). </li><li> Considers only vocabulary words (from NLTK vocabulary). </li><li> By default, considers inflected and variant forms of the same word. </li><li> Returns True/False for every input. </li></ul> Example use:<br> `WordMatch(with_column="expected")` | **Required:** <br> `with_column: str`<br><br>**Optional:**<ul><li>`display_name`</li><li>`mode = 'any'` or `'all'`</li><li>`lemmatize = True` or `False`</li></ul> |
| **WordNoMatch()** <ul><li> Checks whether the text excludes **any** (default) or **all** specified words for each row (represented as tuples). </li><li> Considers only vocabulary words (from NLTK vocabulary). </li><li> By default, considers inflected and variant forms of the same word. </li><li> Returns True/False for every input. </li></ul> Example use:<br> `WordMatch(with_column="forbidden")` | **Required:** <br> `with_column: str`<br><br>**Optional:**<ul><li>`display_name`</li><li>`mode = 'any'` or `'all'`</li><li>`lemmatize = True` or `False`</li></ul> |
| **ExactMatch()** <ul><li>Checks if the text matches between two columns.</li><li>Returns True/False for every input. </li></ul> Example use:<br> `ExactMatch(with_column='reference')`| **Required:** <br>`with_column: str` <br><br>**Optional:**<ul><li>`display_name`</li></ul> |
| **IsValidJSON()** <ul><li>Checks if the text in a specified column is a valid JSON.</li><li>Returns True/False for every input. </li></ul>| **Required:** n/a <br>**Optional:**<ul><li>`display_name`</li></ul> |
| **JSONSchemaMatch()** <ul><li>Checks if the text contains a JSON object matching the expected_schema. </li><li> Supports exact (**exact=True**) or minimal (**exact=False**) matching, with optional strict type validation (**validate_types=True**). </li><li>Returns True/False for each row. </li></ul> Example use:<br> `JSONSchemaMatch(expected_schema={"name": str, "age": int}, exact_match=False, validate_types=True)`| **Required:** <br>`expected_schema: Dict[str, type]`<br><br>**Optional:**<ul><li>`exact_match = True` or `False`</li><li>`validate_types = True` or `False`</li></ul> |
| **JSONMatch()** <ul><li>Compares two columns of a dataframe and checks whether the two objects in each row of the dataframe are matching JSONs or not. </li><li>Returns True/False for every input. </li></ul> Example use:<br> `JSONMatch(with_column="column_2")`| **Required:** <br> `with_column : str` <br><br>**Optional:**<ul><li>`display_name`</li> |
| **ContainsLink()** <ul><li>Checks if the text contains at least one valid URL. </li><li>Returns True/False for each row. </li></ul> | **Required:** n/a <br>**Optional:**<ul><li>`display_name`</li></ul> |
| **IsValidPython()** <ul><li>Checks if the text is valid Python code without syntax errors.</li><li>Returns True/False for every input. </li></ul>| **Required:** <br>n/a<br><br>**Optional:**<ul><li>`display_name`</li></ul> |

## Descriptors: Text stats

Expand Down
2 changes: 1 addition & 1 deletion docs/book/tests-and-reports/run-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions docs/book/tests-and-reports/text-descriptors.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
])
```

Expand Down Expand Up @@ -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),
])
```
Expand Down

0 comments on commit 2883867

Please sign in to comment.