fix: Fix rerank_documents node in sub_section_writer & qna_agent

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2025-07-03 14:09:36 -07:00
parent 3e1db2ac6b
commit 671984acbd
6 changed files with 2708 additions and 1923 deletions

View file

@ -1,8 +1,8 @@
from app.utils.reranker_service import RerankerService
from .configuration import Configuration
from langchain_core.runnables import RunnableConfig
from .state import State
from typing import Any, Dict
from app.config import config as app_config
from .prompts import get_qna_citation_system_prompt, get_qna_no_documents_system_prompt
from langchain_core.messages import HumanMessage, SystemMessage
from ..utils import (
@ -35,7 +35,7 @@ async def rerank_documents(state: State, config: RunnableConfig) -> Dict[str, An
}
# Get reranker service from app config
reranker_service = getattr(app_config, "reranker_service", None)
reranker_service = RerankerService.get_reranker_instance()
# Use documents as is if no reranker service is available
reranked_docs = documents