substring_quote=['in university I studied Computational Mathematics and physics']), FactWithEvidence(fact='The author started the Data Science club at the University of Waterloo and was the president of the club for 2 years.', substring_quote=['started the Data Science club at the University of Waterloo', 'president of the club for 2 years'])]def highlight(text, span):    return (        "..."        + text[span[0] - 20 : span[0]]        + "*"        + "\033[91m"        + text[span[0] : span[1]]        + "\033[0m"        + "*"        + text[span[1] : span[1] + 20]        + "..."    )for fact in result.answer:    print("Statement:", fact.fact)    for span in fact.get_spans(context):        print("Citation:", highlight(context, span))    print()    Statement: The author studied Computational Mathematics and physics in university.    Citation: ...arts highschool but *in university I studied Computational Mathematics and physics*.     As part of coop I...        Statement: The author started the Data Science club at the University of Waterloo and was the president of the club for 2 years.    Citation: ...x, Facebook.    I also *started the Data Science club at the University of Waterloo* and I was the presi...    Citation: ...erloo and I was the *president of the club for 2 years*.    ...    PreviousRetrieving from multiple sourcesNextRetrieve from vector stores directlyCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
This notebook shows how to use OpenAI functions ability to extract citations from text.
This notebook shows how to use OpenAI functions ability to extract citations from text. ->: substring_quote=['in university I studied Computational Mathematics and physics']), FactWithEvidence(fact='The author started the Data Science club at the University of Waterloo and was the president of the club for 2 years.', substring_quote=['started the Data Science club at the University of Waterloo', 'president of the club for 2 years'])]def highlight(text, span):    return (        "..."        + text[span[0] - 20 : span[0]]        + "*"        + "\033[91m"        + text[span[0] : span[1]]        + "\033[0m"        + "*"        + text[span[1] : span[1] + 20]        + "..."    )for fact in result.answer:    print("Statement:", fact.fact)    for span in fact.get_spans(context):        print("Citation:", highlight(context, span))    print()    Statement: The author studied Computational Mathematics and physics in university.    Citation: ...arts highschool but *in university I studied Computational Mathematics and physics*.     As part of coop I...        Statement: The author started the Data Science club at the University of Waterloo and was the president of the club for 2 years.    Citation: ...x, Facebook.    I also *started the Data Science club at the University of Waterloo* and I was the presi...    Citation: ...erloo and I was the *president of the club for 2 years*.    ...    PreviousRetrieving from multiple sourcesNextRetrieve from vector stores directlyCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.