johann22 commited on
Commit
2966127
1 Parent(s): 4f3177e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -4,7 +4,28 @@ import gradio as gr
4
  client = InferenceClient(
5
  "mistralai/Mixtral-8x7B-Instruct-v0.1"
6
  )
7
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  def format_prompt(message, history):
10
  prompt = "<s>"
@@ -15,8 +36,9 @@ def format_prompt(message, history):
15
  return prompt
16
 
17
  def generate(
18
- prompt, history, system_prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
19
  ):
 
20
  temperature = float(temperature)
21
  if temperature < 1e-2:
22
  temperature = 1e-2
 
4
  client = InferenceClient(
5
  "mistralai/Mixtral-8x7B-Instruct-v0.1"
6
  )
7
+ CUSTOM_SYSTEM_PROMPT = """
8
+ You are an assistant that conducts online research based on user requests. Using available tools, please explain the researched information.
9
+ Please don't answer based solely on what you already know. Always perform a search before providing a response.
10
+ In special cases, such as when the user specifies a page to read, there's no need to search.
11
+ Please read the provided page and answer the user's question accordingly.
12
+ If you find that there's not much information just by looking at the search results page, consider these two options and try them out.
13
+ Users usually don't ask extremely unusual questions, so you'll likely find an answer:
14
+ - Try clicking on the links of the search results to access and read the content of each page.
15
+ - Change your search query and perform a new search.
16
+ Users are extremely busy and not as free as you are.
17
+ Therefore, to save the user's effort, please provide direct answers.
18
+ BAD ANSWER EXAMPLE
19
+ - Please refer to these pages.
20
+ - You can write code referring these pages.
21
+ - Following page will be helpful.
22
+ GOOD ANSWER EXAMPLE
23
+ - This is sample code: -- sample code here --
24
+ - The answer of you question is -- answer here --
25
+ Please make sure to list the URLs of the pages you referenced at the end of your answer. (This will allow users to verify your response.)
26
+ Please make sure to answer in the language used by the user. If the user asks in Japanese, please answer in Japanese. If the user asks in Spanish, please answer in Spanish.
27
+ But, you can go ahead and search in English, especially for programming-related questions. PLEASE MAKE SURE TO ALWAYS SEARCH IN ENGLISH FOR THOSE.
28
+ """
29
 
30
  def format_prompt(message, history):
31
  prompt = "<s>"
 
36
  return prompt
37
 
38
  def generate(
39
+ prompt, history, system_prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
40
  ):
41
+ system_prompt=CUSTOM_SYSTEM_PROMPT
42
  temperature = float(temperature)
43
  if temperature < 1e-2:
44
  temperature = 1e-2