Revert to v1.0-working baseline (score 0.5094)
Improvements to RERANK_LIMIT, search_text, variants made score worse. Reverting to investigate better approach. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4822bbb24b
commit
6831a5d149
2 changed files with 10 additions and 17 deletions
|
|
@ -11,7 +11,7 @@ from pydantic import BaseModel
|
|||
|
||||
HOST = os.getenv("HOST", "0.0.0.0")
|
||||
PORT = int(os.getenv("PORT", "8000"))
|
||||
UVICORN_WORKERS = 4
|
||||
UVICORN_WORKERS = 8
|
||||
|
||||
logging.basicConfig(level=os.getenv("LOG_LEVEL", "INFO"))
|
||||
logger = logging.getLogger("index-service")
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ app = FastAPI(title="Search Service", version="0.1.0", lifespan=lifespan)
|
|||
DENSE_PREFETCH_K = 80
|
||||
SPARSE_PREFETCH_K = 200
|
||||
RETRIEVE_K = 150
|
||||
RERANK_LIMIT = 60
|
||||
RERANK_LIMIT = 10
|
||||
|
||||
|
||||
async def embed_dense(client: httpx.AsyncClient, text: str) -> list[float]:
|
||||
|
|
@ -211,16 +211,15 @@ def embed_sparse_sync(text: str) -> SparseVector:
|
|||
|
||||
|
||||
def build_dense_query(question: Question) -> str:
|
||||
if question.search_text:
|
||||
return question.search_text.strip()
|
||||
return question.text.strip()
|
||||
|
||||
|
||||
def build_sparse_query(question: Question) -> str:
|
||||
base = question.search_text.strip() if question.search_text else question.text.strip()
|
||||
parts = [base]
|
||||
parts = [question.text.strip()]
|
||||
if question.keywords:
|
||||
parts.extend(question.keywords)
|
||||
if question.search_text:
|
||||
parts = [question.search_text]
|
||||
return " ".join(parts)
|
||||
|
||||
|
||||
|
|
@ -359,19 +358,13 @@ async def search(payload: SearchAPIRequest) -> SearchAPIResponse:
|
|||
dense_vector, sparse_vector = await asyncio.gather(dense_task, sparse_task)
|
||||
|
||||
dense_vectors = [dense_vector]
|
||||
extra_texts: list[str] = []
|
||||
for v in (question.variants or [])[:2]:
|
||||
if v.strip():
|
||||
extra_texts.append(v.strip())
|
||||
for h in (question.hyde or [])[:2]:
|
||||
if h.strip():
|
||||
extra_texts.append(h.strip())
|
||||
if extra_texts:
|
||||
if question.hyde and len(question.hyde) > 0:
|
||||
try:
|
||||
extra_vectors = await embed_dense_batch(client, extra_texts)
|
||||
dense_vectors.extend(extra_vectors)
|
||||
hyde_texts = question.hyde[:2]
|
||||
hyde_vectors = await embed_dense_batch(client, hyde_texts)
|
||||
dense_vectors.extend(hyde_vectors)
|
||||
except Exception as e:
|
||||
logger.warning(f"Extra dense embedding failed: {e}")
|
||||
logger.warning(f"HyDE embedding failed: {e}")
|
||||
|
||||
all_points = await qdrant_search(qdrant, dense_vectors, sparse_vector)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue