(node: Dict[str, Any], max_chars: int = 700)
| 68 | |
| 69 | |
| 70 | def _snippet(node: Dict[str, Any], max_chars: int = 700) -> str: |
| 71 | body = str(node.get("body") or "").strip() |
| 72 | if len(body) <= max_chars: |
| 73 | return body |
| 74 | head = body[: max_chars // 2].rstrip() |
| 75 | tail = body[-max_chars // 2 :].lstrip() |
| 76 | return f"{head}\n...\n{tail}" |
| 77 | |
| 78 | |
| 79 | def _build_prompt(question: str, hits: List[Dict[str, Any]]) -> str: |
no test coverage detected