langchain
langchain copied to clipboard
StructuredOutputParser - Allow users to get multiple items from response.
- Allow users to choose the type in the schema (string | List[string])
- Allow users to get multiple json objects (get JSON array) in the response. I achieved it by replacing the {{ }} -> [[ ]] as follows:
prompt.replace("""{{ "ID": string // IDs which refers to the sentences. "Text": string // Sentences that contains the answer to the question. }}""", """[[ "ID": string // IDs which refers to the sentences. "Text": string // Sentences that contains the answer to the question. ]]""")
And got a list of json objects with this method.