chore: pre-commit changes

This commit is contained in:
sarthakdeshpande 2025-03-09 17:42:46 +05:30
parent 501467846d
commit 73cb368900

View file

@ -4,11 +4,11 @@
# This source code is licensed under the terms described in the LICENSE file in # This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree. # the root directory of this source tree.
import asyncio
import base64 import base64
import io import io
import json import json
import logging import logging
import asyncio
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
import faiss import faiss
@ -100,9 +100,7 @@ class FaissIndex(EmbeddingIndex):
await self._save_index() await self._save_index()
async def query(self, embedding: NDArray, k: int, score_threshold: float) -> QueryChunksResponse: async def query(self, embedding: NDArray, k: int, score_threshold: float) -> QueryChunksResponse:
distances, indices = await asyncio.to_thread( distances, indices = await asyncio.to_thread(self.index.search, embedding.reshape(1, -1).astype(np.float32), k)
self.index.search, embedding.reshape(1, -1).astype(np.float32), k
)
chunks = [] chunks = []
scores = [] scores = []