Skip invalid research service sources (#1583)
This commit is contained in:
parent
953305a5af
commit
0ad5cd783b
2 changed files with 2 additions and 0 deletions
|
|
@ -92,6 +92,7 @@ class ResearchService:
|
||||||
relevance=s.get("relevance", 0.0),
|
relevance=s.get("relevance", 0.0),
|
||||||
)
|
)
|
||||||
for s in result.get("sources", [])
|
for s in result.get("sources", [])
|
||||||
|
if isinstance(s, dict)
|
||||||
]
|
]
|
||||||
return ResearchResult(
|
return ResearchResult(
|
||||||
query=topic,
|
query=topic,
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,7 @@ class TestDictBackCompat:
|
||||||
"sources": [
|
"sources": [
|
||||||
{"url": "https://x.example", "title": "X",
|
{"url": "https://x.example", "title": "X",
|
||||||
"snippet": "s", "relevance": 0.9},
|
"snippet": "s", "relevance": 0.9},
|
||||||
|
"bad source row",
|
||||||
],
|
],
|
||||||
"sections": ["intro"],
|
"sections": ["intro"],
|
||||||
"tokens_used": 42,
|
"tokens_used": 42,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue