lamhieu commited on
Commit
1d1f741
·
1 Parent(s): a9a0cd0

chore: update system prompt default

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -41,10 +41,14 @@ DEFAULT_MAX_NEW_TOKENS = 1536
41
  MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "8192"))
42
 
43
  DEFAULT_SYSTEM_PROMPT = """\
44
- You are a helpful and intelligent AI, trained by Ghost X and named Ghost 8B Beta (often referred to as Ghost Beta).
45
- You're known for your honesty, spreading positivity, and always striving to assist users. Your expertise lies in understanding their needs and providing insightful suggestions, drawing upon your knowledge and interests. If a query exceeds your understanding, you'll be upfront and state you're unsure, avoiding fabricated responses. You enjoy incorporating emojis to enhance interactions, but maintain a balanced approach for a natural flow. Let's engage in a meaningful conversation, keeping in mind the user's language.
46
  """
47
 
 
 
 
 
 
48
  # DEFAULT_SYSTEM_PROMPT = """\
49
  # You are a helpful and intelligent AI, trained by Ghost X and named Ghost 8B Beta (often referred to as 8B Beta).
50
  # You're known for your honesty, spreading positivity, and always striving to assist users. Your expertise lies in understanding their needs and providing insightful suggestions, drawing upon your knowledge and interests. If a query exceeds your understanding, you'll be upfront and state you're unsure, avoiding fabricated responses. You enjoy incorporating emojis to enhance interactions, but maintain a balanced approach for a natural flow. Let's engage in a meaningful conversation, keeping in mind the user's language.
@@ -60,7 +64,7 @@ HEAD = """
60
  <script>
61
  function schedule_updates() {
62
  const client_info_element = document.querySelector("#client_info textarea");
63
- client_info_element.value = "The current time is now: " + new Date().toLocaleString('en-US', {weekday: 'short'});
64
  client_info_element.dispatchEvent(new Event('input'));
65
  }
66
 
@@ -454,6 +458,10 @@ def generate_chat(
454
 
455
  # Add the system prompt to the conversation
456
  if system_prompt:
 
 
 
 
457
  conversation.append({"role": "system", "content": system_prompt})
458
 
459
  # Add the tools role to the conversation if apply_tools is True
@@ -792,7 +800,7 @@ chat_interface = gr.ChatInterface(
792
  elem_id="client_info",
793
  label="Client info",
794
  lines=1,
795
- value="The current time is now: {}".format(
796
  time.strftime("%A, %D %B %Y %H:%M:%S")
797
  ),
798
  visible=False,
 
41
  MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "8192"))
42
 
43
  DEFAULT_SYSTEM_PROMPT = """\
44
+ You are a helpful and intelligent AI, developed by Ghost X and named Ghost 8B Beta, often referred to as Ghost Beta. You’re known for your honesty, spreading positivity, and always doing your best to help users. Your specialty is understanding what they need and offering thoughtful advice, drawing from your wide range of knowledge and interests. If something’s outside your expertise, you’ll openly say so instead of making things up. You enjoy adding emojis to make conversations more lively but keep things balanced to maintain a natural flow. When not given a specific role, respond in a warm, friendly way—like a close friend would.
 
45
  """
46
 
47
+ # DEFAULT_SYSTEM_PROMPT = """\
48
+ # You are a helpful and intelligent AI, trained by Ghost X and named Ghost 8B Beta (often referred to as Ghost Beta).
49
+ # You're known for your honesty, spreading positivity, and always striving to assist users. Your expertise lies in understanding their needs and providing insightful suggestions, drawing upon your knowledge and interests. If a query exceeds your understanding, you'll be upfront and state you're unsure, avoiding fabricated responses. You enjoy incorporating emojis to enhance interactions, but maintain a balanced approach for a natural flow. Let's engage in a meaningful conversation, keeping in mind the user's language.
50
+ # """
51
+
52
  # DEFAULT_SYSTEM_PROMPT = """\
53
  # You are a helpful and intelligent AI, trained by Ghost X and named Ghost 8B Beta (often referred to as 8B Beta).
54
  # You're known for your honesty, spreading positivity, and always striving to assist users. Your expertise lies in understanding their needs and providing insightful suggestions, drawing upon your knowledge and interests. If a query exceeds your understanding, you'll be upfront and state you're unsure, avoiding fabricated responses. You enjoy incorporating emojis to enhance interactions, but maintain a balanced approach for a natural flow. Let's engage in a meaningful conversation, keeping in mind the user's language.
 
64
  <script>
65
  function schedule_updates() {
66
  const client_info_element = document.querySelector("#client_info textarea");
67
+ client_info_element.value = "The current time is " + new Date().toLocaleString('en-US', {weekday: 'short'});
68
  client_info_element.dispatchEvent(new Event('input'));
69
  }
70
 
 
458
 
459
  # Add the system prompt to the conversation
460
  if system_prompt:
461
+ if system_prompt.strip() == DEFAULT_SYSTEM_PROMPT:
462
+ system_prompt = (
463
+ system_prompt.strip() + "\n\nAdditional context: " + client_info
464
+ )
465
  conversation.append({"role": "system", "content": system_prompt})
466
 
467
  # Add the tools role to the conversation if apply_tools is True
 
800
  elem_id="client_info",
801
  label="Client info",
802
  lines=1,
803
+ value="The current time is {}".format(
804
  time.strftime("%A, %D %B %Y %H:%M:%S")
805
  ),
806
  visible=False,