Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Janice Manwiller <[email protected]>
  • Loading branch information
akamor and JaniceManwiller authored Dec 2, 2024
1 parent 29f8d31 commit a1743d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions docs/source/redact/redacting_text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This produces the following output:
"new_text": "[ORGANIZATION_P5XLAH]"
}
`redact` calls can also be recorded so you can view and analyze results in our UI. To learn more, read :ref:`record-api-call-section`
You can also record `redact` calls, so that you can view and analyze results in the Textual application. To learn more, read :ref:`record-api-call-section`

Bulk redact raw text
---------------------
Expand Down Expand Up @@ -308,7 +308,7 @@ Note that LLM Synthesis is non-deterministic — you will likely get different r

Recording API requests
----------------------
When you redact text with the :meth:`redact<tonic_textual.redact_api.TextualNer.redact>` method you can optionally record these requests for later viewing and analysis in the UI. The `redact` method takes an optional argument called `record_options` (:class:`RecordApiRequestOptions<tonic_textual.classes.record_api_request_options.RecordApiRequestOptions>`). To record an API request you can do the following:
When you use the :meth:`redact<tonic_textual.redact_api.TextualNer.redact>` method to redact text, you can optionally record these requests to view and analyze later in the Textual application. The `redact` method takes an optional `record_options` (:class:`RecordApiRequestOptions<tonic_textual.classes.record_api_request_options.RecordApiRequestOptions>`) argument. To record an API request:

.. code-block:: python
Expand All @@ -323,4 +323,4 @@ When you redact text with the :meth:`redact<tonic_textual.redact_api.TextualNer.
tags=["my_first_request"])
)
The above code will run the redaction as normal, and then record the API Request and its results. The request itself will be automatically purged after 1 hour. Results are viewable in the UI from the API Explorer page.
The above code runs the redaction in the same way as any other redaction request, and then records the API request and its results. The request itself is automatically purged after 1 hour. You can view the results from the **API Explorer** page in Textual.
8 changes: 4 additions & 4 deletions tonic_textual/classes/record_api_request_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

class RecordApiRequestOptions(dict):
"""
Class to denote if an API request should be recorded.
Class to denote whether to record an API request.
Parameters
----------
record : bool
Indicates whether the request should be recorded.
Whether to record the request.
retention_time_in_hours: int
The number of hours to store the request. Afterwards, the request is automatically purged..
The number of hours to store the request. The request is then purged automatically.
tags : Optional[List[str]]
An optional list of tags to use for the request. Makes searching for requests in the UI easier.
An optional list of tags to assign to the request. Used to help search for the request on the API Explorer page.
"""
def __init__(self, record: bool, retention_time_in_hours: int, tags: Optional[List[str]] = []):
self.record = record
Expand Down
4 changes: 2 additions & 2 deletions tonic_textual/redact_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def redact(
the text is marked as the entity type and is included in the redaction or synthesis.
record_options: Optional[RecordApiRequestOptions]
An optional value to record API request and result for analysis in UI. The default value is False.
An optional value to record API the request and results for analysis in the Textual application. The default value is False.
Returns
-------
Expand Down Expand Up @@ -347,7 +347,7 @@ def redact_bulk(
the text is marked as the entity type and is included in the redaction or synthesis.
record: Optional[bool]
An optional value to record API request and result for analysis in UI. The default value is False.
An optional value to record the API request and results for analysis in the Textual application. The default value is False.
Returns
-------
Expand Down

0 comments on commit a1743d6

Please sign in to comment.