Limits the search result snippet returned by exa search api

Changed the request to only return a highlights snippet for each search result instead of the entire web page content.
This commit is contained in:
wundergeu 2026-05-01 12:54:11 +02:00 committed by GitHub
parent 8dae237a0b
commit f4754dc129
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,7 +39,7 @@ def search_exa(
'query': query,
'numResults': count or 5,
'includeDomains': filter_list,
'contents': {'text': True, 'highlights': True},
'contents': {'highlights': {'max_characters': 600}},
'type': 'auto', # Use the auto search type (keyword or neural)
}
@ -54,7 +54,7 @@ def search_exa(
ExaResult(
url=result['url'],
title=result['title'],
text=result['text'],
text=result['highlights'][0],
)
)