A data processing system comprising: a processor; and a memory in communication with the processor, the memory comprising executable instructions that, when executed by, the processor, cause the data processing system to perform functions of: receiving an indication of a user's interaction with a document , the interaction including drafting a sentence ; accessing contextual document data associated with the document; providing at least one of information about the user action or the contextual document data as input to a machine-leaming, ML, model to predict that a desired intent of the user is to complete the sentence with factual information; obtaining the predicted desired intent as an output from the ML model; determining that the predicted desired intent includes conducting a search; providing one or more search terms related to the predicted desired intent to a search service for conducting the search; obtaining, from the search service, one or more search results containing factual information that relate to the sentence; providing the one or more search results for display as selectable elements in a user interface element ; and upon selection by the user of a selectable element corresponding to a given search result of the one or more search results, inserting the factual information contained in the given search result into the sentence. a processor; and a memory in communication with the processor, the memory comprising executable instructions that, when executed by, the processor, cause the data processing system to perform functions of: receiving an indication of a user's interaction with a document , the interaction including drafting a sentence ; accessing contextual document data associated with the document; providing at least one of information about the user action or the contextual document data as input to a machine-leaming, ML, model to predict that a desired intent of the user is to complete the sentence with factual information; obtaining the predicted desired intent as an output from the ML model; determining that the predicted desired intent includes conducting a search; providing one or more search terms related to the predicted desired intent to a search service for conducting the search; obtaining, from the search service, one or more search results containing factual information that relate to the sentence; providing the one or more search results for display as selectable elements in a user interface element ; and upon selection by the user of a selectable element corresponding to a given search result of the one or more search results, inserting the factual information contained in the given search result into the sentence. receiving an indication of a user's interaction with a document , the interaction including drafting a sentence ; accessing contextual document data associated with the document; providing at least one of information about the user action or the contextual document data as input to a machine-leaming, ML, model to predict that a desired intent of the user is to complete the sentence with factual information; obtaining the predicted desired intent as an output from the ML model; determining that the predicted desired intent includes conducting a search; providing one or more search terms related to the predicted desired intent to a search service for conducting the search; obtaining, from the search service, one or more search results containing factual information that relate to the sentence; providing the one or more search results for display as selectable elements in a user interface element ; and upon selection by the user of a selectable element corresponding to a given search result of the one or more search results, inserting the factual information contained in the given search result into the sentence. <EOS>