Skip to content

fix(agent): don't add blocks that contain only punctuation#469

Merged
douglas-reid merged 6 commits into
mainfrom
doug/block-parsing
Jul 13, 2023
Merged

fix(agent): don't add blocks that contain only punctuation#469
douglas-reid merged 6 commits into
mainfrom
doug/block-parsing

Conversation

@douglas-reid
Copy link
Copy Markdown
Contributor

Trailing punctuation blocks are of little to no value (imho). This PR ensures that we don't add those blocks.

From:

Here is the image you requested: 
(image/png: B1A98152-A422-4B44-8FD9-D7C954E82D2A)
.

To:

Here is the image you requested: 
(image/png: B1A98152-A422-4B44-8FD9-D7C954E82D2A)

@douglas-reid douglas-reid requested a review from dkolas July 11, 2023 18:23
dkolas
dkolas previously approved these changes Jul 12, 2023
Copy link
Copy Markdown
Contributor

@dkolas dkolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One question below. I'm good either way, just whatever you think best.


# TODO(dougreid): extract shared bits from this and the ReACT output parser into a utility?
def is_punctuation(text: str):
return text in string.punctuation
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want this to return true if ALL the text is punctuation, or only if it is a single character of punctuation? The current implementation does the latter:

>>> s = ".."
>>> import string
>>> s in string.punctuation
False

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. updated. still doesn't filter strings like .... .... ..., but that is so degenerate a case that I'm not sure we need to worry about it.

@douglas-reid
Copy link
Copy Markdown
Contributor Author

PTAL.

@douglas-reid douglas-reid merged commit 302e17e into main Jul 13, 2023
@douglas-reid douglas-reid deleted the doug/block-parsing branch July 13, 2023 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants