Update src/api/agent.py
Browse files- src/api/agent.py +6 -4
src/api/agent.py
CHANGED
|
@@ -1552,12 +1552,14 @@ def _extractive_snapshot_from_papers(topic: str, papers: List[dict]) -> str:
|
|
| 1552 |
async def _search_primo_catalog(context: SearchContextPayload, limit: int = 5) -> Tuple[dict, str]:
|
| 1553 |
from src.api.search import SearchRequest, search_primo
|
| 1554 |
settings = get_settings()
|
| 1555 |
-
|
| 1556 |
-
|
| 1557 |
-
|
|
|
|
|
|
|
| 1558 |
result = await search_primo(
|
| 1559 |
SearchRequest(
|
| 1560 |
-
query=
|
| 1561 |
source="primo",
|
| 1562 |
limit=limit,
|
| 1563 |
peer_reviewed=context.peer_reviewed,
|
|
|
|
| 1552 |
async def _search_primo_catalog(context: SearchContextPayload, limit: int = 5) -> Tuple[dict, str]:
|
| 1553 |
from src.api.search import SearchRequest, search_primo
|
| 1554 |
settings = get_settings()
|
| 1555 |
+
# Use the LLM-built boolean query if available, else fall back to plain topic
|
| 1556 |
+
boolean = context.primo_boolean_query
|
| 1557 |
+
if not boolean:
|
| 1558 |
+
clean_topic = _strip_resource_noise(context.topic)
|
| 1559 |
+
boolean = clean_topic or context.topic
|
| 1560 |
result = await search_primo(
|
| 1561 |
SearchRequest(
|
| 1562 |
+
query=boolean,
|
| 1563 |
source="primo",
|
| 1564 |
limit=limit,
|
| 1565 |
peer_reviewed=context.peer_reviewed,
|