from typing import Dict # Dictionary to store user-specific prompts user_prompts = {} # Define default prompt templates DEFAULT_SYSTEM_TEMPLATE = """\ Use the following context to answer a users question. If you cannot find the answer in the context, say you don't know the answer. IMPORTANT: Format your response with your thinking process and final answer as follows: 1. First provide your reasoning process inside ... tags 2. Then provide your final answer, either: - Using ... tags (preferred) - Or simply provide the answer directly after your thinking section For example: I'm analyzing the question in relation to the context. The question asks about X, and in the context I see information about Y and Z, which relates to X in the following way... Based on the context, the answer is... Or alternatively: I'm analyzing the question in relation to the context. The question asks about X, and in the context I see information about Y and Z, which relates to X in the following way... Based on the context, the answer is... """ DEFAULT_USER_TEMPLATE = """\ Context: {context} Question: {question} """ def get_user_prompts(user_id: str) -> Dict[str, str]: """ Get prompts for a specific user Args: user_id: User ID to get prompts for Returns: Dictionary with system_template and user_template """ if user_id not in user_prompts: # Initialize with default prompts if not exists user_prompts[user_id] = { "system_template": DEFAULT_SYSTEM_TEMPLATE, "user_template": DEFAULT_USER_TEMPLATE } return user_prompts[user_id]