Build the text payload used for paper embeddings.
(paper: Dict[str, Any])
| 174 | |
| 175 | |
| 176 | def build_paper_text(paper: Dict[str, Any]) -> str: |
| 177 | """Build the text payload used for paper embeddings.""" |
| 178 | title = str(paper.get("title") or "").strip() |
| 179 | abstract = str(paper.get("abstract") or paper.get("cleaned_abstract") or "").strip() |
| 180 | keywords = paper.get("keywords") or [] |
| 181 | |
| 182 | blocks = [] |
| 183 | if title: |
| 184 | blocks.append(title) |
| 185 | if abstract: |
| 186 | blocks.append(abstract) |
| 187 | if keywords: |
| 188 | blocks.append("Keywords: " + ", ".join(str(keyword).strip() for keyword in keywords if str(keyword).strip())) |
| 189 | |
| 190 | return "\n\n".join(block for block in blocks if block).strip() |
| 191 | |
| 192 | |
| 193 | def _requires_trust_remote_code(model_name: str) -> bool: |
no test coverage detected