reranking package

rerank module

import datetime, uuid, logging, json, random import asyncio

from django_core.config import Config from rag_service.openai_service import make_openai_request, query_qdrant_collection

reranking.rerank.parse_single_rerank_json(json_string: str)[source]

Parse single entry of reranked result.

async reranking.rerank.rerank_query(original_query, rephrased_query, email_id, retrieval_results=[])[source]

Rerank the retrieved content chunks with the rephrased query from OpenAI.

utils module

from database.models import RerankMetrics from database.db_operations import create_record

reranking.utils.insert_rerank_data(rerank_data_logs: dict, message_id: str | None = None)[source]

Save the rerank metric logs associated with a specific message.