langchain icon indicating copy to clipboard operation
langchain copied to clipboard

fix: remove empty lines that cause InvalidRequestError

Open mbchang opened this issue 2 years ago • 0 comments

remove empty lines in GenerativeAgentMemory that cause InvalidRequestError in OpenAIEmbeddings

Let's say the text given to GenerativeAgent._parse_list is

text = """
Insight 1: <insight 1>

Insight 2: <insight 2>
"""

This creates an openai.error.InvalidRequestError: [''] is not valid under any of the given schemas - 'input' because GenerativeAgent.add_memory() tries to add an empty string to the vectorstore.

This PR fixes the issue by removing the empty line between Insight 1 and Insight 2

Before submitting

Who can review?

Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested:

@hwchase17 @vowelparrot @dev2049

mbchang avatar May 26 '23 22:05 mbchang