diff --git a/api/Dockerfile b/api/Dockerfile index adf9173f97..06a6f43631 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -55,6 +55,9 @@ ENV VIRTUAL_ENV=/app/api/.venv COPY --from=packages ${VIRTUAL_ENV} ${VIRTUAL_ENV} ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" +# Download nltk data +RUN python -c "import nltk; nltk.download('punkt')" + # Copy source code COPY . /app/api/ diff --git a/api/core/rag/rerank/weight_rerank.py b/api/core/rag/rerank/weight_rerank.py index d07f94adb7..d8a7873982 100644 --- a/api/core/rag/rerank/weight_rerank.py +++ b/api/core/rag/rerank/weight_rerank.py @@ -159,10 +159,9 @@ class WeightRerankRunner: if 'score' in document.metadata: query_vector_scores.append(document.metadata['score']) else: - content_vector = document.metadata['vector'] # transform to NumPy vec1 = np.array(query_vector) - vec2 = np.array(document.metadata['vector']) + vec2 = np.array(document.vector) # calculate dot product dot_product = np.dot(vec1, vec2)