feat(agent): scrape linked pages to ground answers in real content
Adds `_fetch_page_content()`, which downloads a URL with a browser-like User-Agent and uses BeautifulSoup with the lxml parser to strip scripts, navigation, and other non-content markup, returning up to 3000 characters of readable text. The response validator now also compares generated replies against this scraped text, flagging named entities and claims that do not appear in the retrieved page content. Dependencies: adds beautifulsoup4==4.12.3 and pins lxml==5.3.0 for parser compatibility.
This commit is contained in:
@@ -34,11 +34,7 @@ typedef enum {
|
||||
XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */
|
||||
XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */
|
||||
XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */
|
||||
XML_SAVE_WSNONSIG = 1<<7, /* format with non-significant whitespace */
|
||||
/* Available since 2.14.0 */
|
||||
XML_SAVE_EMPTY = 1<<8, /* force empty tags, overriding global */
|
||||
XML_SAVE_NO_INDENT = 1<<9, /* disable indenting */
|
||||
XML_SAVE_INDENT = 1<<10 /* force indenting, overriding global */
|
||||
XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */
|
||||
} xmlSaveOption;
|
||||
|
||||
|
||||
@@ -77,27 +73,17 @@ XMLPUBFUN int
|
||||
xmlSaveFlush (xmlSaveCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlSaveClose (xmlSaveCtxtPtr ctxt);
|
||||
XMLPUBFUN xmlParserErrors
|
||||
xmlSaveFinish (xmlSaveCtxtPtr ctxt);
|
||||
XMLPUBFUN int
|
||||
xmlSaveSetIndentString (xmlSaveCtxtPtr ctxt,
|
||||
const char *indent);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlSaveSetEscape (xmlSaveCtxtPtr ctxt,
|
||||
xmlCharEncodingOutputFunc escape);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt,
|
||||
xmlCharEncodingOutputFunc escape);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlThrDefIndentTreeOutput(int v);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN const char *
|
||||
xmlThrDefTreeIndentString(const char * v);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlThrDefSaveNoEmptyTags(int v);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user