Spaces:
Runtime error
Runtime error
Download src/search.py from ResumeScreening/resume-screening-rag: direct link, hf CLI and curl.
- Browser
- Download file 737 Bytes
-
https://huggingface.co/spaces/ResumeScreening/resume-screening-rag/resolve/main/src/search.py
- Command line
-
hf download hf://spaces/ResumeScreening/resume-screening-rag/src/search.py
-
curl -L -o search.py https://huggingface.co/spaces/ResumeScreening/resume-screening-rag/resolve/main/src/search.py
737 Bytes
| from __future__ import annotations | |
| from typing import Any | |
| def search_resumes( | |
| query: str, | |
| embed_query_fn, | |
| vector_store, | |
| top_k: int = 8, | |
| namespace: str = "resumes", | |
| ) -> list[dict[str, Any]]: | |
| qvec = embed_query_fn(query) | |
| matches = vector_store.query(vector=qvec, top_k=top_k, namespace=namespace) | |
| results = [] | |
| for m in matches: | |
| md = m.get("metadata", {}) or {} | |
| results.append({ | |
| "score": float(m.get("score", 0.0)), | |
| "filename": md.get("filename", "unknown"), | |
| "page": md.get("page", None), | |
| "chunk_index": md.get("chunk_index", None), | |
| "text": md.get("text", ""), | |
| "id": m.get("id", ""), | |
| }) | |
| return results |