nikeshn commited on
Commit
835b166
·
verified ·
1 Parent(s): 9dc2635

Update src/api/agent.py

Browse files
Files changed (1) hide show
  1. 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
- clean_topic = _strip_resource_noise(context.topic)
1556
- if not clean_topic:
1557
- clean_topic = context.topic
 
 
1558
  result = await search_primo(
1559
  SearchRequest(
1560
- query=clean_topic,
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,