feat: add language support across configurations and prompts

This commit is contained in:
Tarun 2025-10-12 13:13:42 +05:30
parent 402039f02f
commit 045537aa79
16 changed files with 242 additions and 18 deletions

View file

@ -102,7 +102,7 @@ async def answer_question(state: State, config: RunnableConfig) -> dict[str, Any
user_query = configuration.user_query
user_id = configuration.user_id
search_space_id = configuration.search_space_id
language = configuration.language
# Get user's fast LLM
llm = await get_user_fast_llm(state.db_session, user_id, search_space_id)
if not llm:
@ -127,7 +127,7 @@ async def answer_question(state: State, config: RunnableConfig) -> dict[str, Any
"""
# Use initial system prompt for token calculation
initial_system_prompt = get_qna_citation_system_prompt(chat_history_str)
initial_system_prompt = get_qna_citation_system_prompt(chat_history_str, language)
base_messages = [
SystemMessage(content=initial_system_prompt),
HumanMessage(content=base_human_message_template),
@ -146,9 +146,9 @@ async def answer_question(state: State, config: RunnableConfig) -> dict[str, Any
# Choose system prompt based on final document availability
system_prompt = (
get_qna_citation_system_prompt(chat_history_str)
get_qna_citation_system_prompt(chat_history_str, language)
if has_documents
else get_qna_no_documents_system_prompt(chat_history_str)
else get_qna_no_documents_system_prompt(chat_history_str, language)
)
# Generate documents section