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:
@@ -14,9 +14,8 @@
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -156,10 +155,6 @@ XMLPUBFUN void
|
||||
xmlRelaxNGParserCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror,
|
||||
void *ctx);
|
||||
XMLPUBFUN void
|
||||
xmlRelaxNGSetResourceLoader (xmlRelaxNGParserCtxtPtr ctxt,
|
||||
xmlResourceLoader loader,
|
||||
void *vctxt);
|
||||
XMLPUBFUN xmlRelaxNGPtr
|
||||
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void
|
||||
@@ -219,6 +214,6 @@ XMLPUBFUN int
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
#endif /* __XML_RELAX_NG__ */
|
||||
|
||||
Reference in New Issue
Block a user