File size: 1,731 Bytes
73641c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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 <think>...</think> tags
2. Then provide your final answer, either:
   - Using <answer>...</answer> tags (preferred)
   - Or simply provide the answer directly after your thinking section

For example:
<think>
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...
</think>
<answer>
Based on the context, the answer is...
</answer>

Or alternatively:
<think>
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...
</think>
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]