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:
@@ -13,6 +13,7 @@
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_REGEXP_ENABLED
|
||||
#ifdef LIBXML_AUTOMATA_ENABLED
|
||||
|
||||
#include <libxml/xmlstring.h>
|
||||
|
||||
@@ -39,31 +40,24 @@ typedef xmlAutomataState *xmlAutomataStatePtr;
|
||||
/*
|
||||
* Building API
|
||||
*/
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataPtr
|
||||
xmlNewAutomata (void);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN void
|
||||
xmlFreeAutomata (xmlAutomataPtr am);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataGetInitState (xmlAutomataPtr am);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlAutomataSetFinalState (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr state);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewState (xmlAutomataPtr am);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewTransition (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
const xmlChar *token,
|
||||
void *data);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewTransition2 (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
@@ -71,7 +65,6 @@ XMLPUBFUN xmlAutomataStatePtr
|
||||
const xmlChar *token,
|
||||
const xmlChar *token2,
|
||||
void *data);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewNegTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
@@ -80,7 +73,6 @@ XMLPUBFUN xmlAutomataStatePtr
|
||||
const xmlChar *token2,
|
||||
void *data);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewCountTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
@@ -89,7 +81,6 @@ XMLPUBFUN xmlAutomataStatePtr
|
||||
int min,
|
||||
int max,
|
||||
void *data);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewCountTrans2 (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
@@ -99,7 +90,6 @@ XMLPUBFUN xmlAutomataStatePtr
|
||||
int min,
|
||||
int max,
|
||||
void *data);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewOnceTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
@@ -108,7 +98,6 @@ XMLPUBFUN xmlAutomataStatePtr
|
||||
int min,
|
||||
int max,
|
||||
void *data);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewOnceTrans2 (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
@@ -118,39 +107,32 @@ XMLPUBFUN xmlAutomataStatePtr
|
||||
int min,
|
||||
int max,
|
||||
void *data);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewAllTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
int lax);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewEpsilon (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewCountedTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
int counter);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN xmlAutomataStatePtr
|
||||
xmlAutomataNewCounterTrans (xmlAutomataPtr am,
|
||||
xmlAutomataStatePtr from,
|
||||
xmlAutomataStatePtr to,
|
||||
int counter);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlAutomataNewCounter (xmlAutomataPtr am,
|
||||
int min,
|
||||
int max);
|
||||
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN struct _xmlRegexp *
|
||||
xmlAutomataCompile (xmlAutomataPtr am);
|
||||
XML_DEPRECATED
|
||||
XMLPUBFUN int
|
||||
xmlAutomataIsDeterminist (xmlAutomataPtr am);
|
||||
|
||||
@@ -158,6 +140,7 @@ XMLPUBFUN int
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_AUTOMATA_ENABLED */
|
||||
#endif /* LIBXML_REGEXP_ENABLED */
|
||||
|
||||
#endif /* __XML_AUTOMATA_H__ */
|
||||
|
||||
Reference in New Issue
Block a user