Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,30 @@ import gradio as gr
|
|
4 |
client = InferenceClient(
|
5 |
"mistralai/Mixtral-8x7B-Instruct-v0.1"
|
6 |
)
|
7 |
-
|
8 |
-
You are an
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
@@ -26,7 +48,6 @@ Please make sure to list the URLs of the pages you referenced at the end of your
|
|
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 |
|
31 |
def format_prompt(message, history):
|
32 |
prompt = "<s>"
|
@@ -39,7 +60,7 @@ def format_prompt(message, history):
|
|
39 |
def generate(
|
40 |
prompt, history, system_prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
41 |
):
|
42 |
-
system_prompt=
|
43 |
temperature = float(temperature)
|
44 |
if temperature < 1e-2:
|
45 |
temperature = 1e-2
|
|
|
4 |
client = InferenceClient(
|
5 |
"mistralai/Mixtral-8x7B-Instruct-v0.1"
|
6 |
)
|
7 |
+
WEB_DEV_SYSTEM_PROMPT = """
|
8 |
+
You are an expert web developer who responds with complete program coding to client 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 the complete code: -- complete 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 |
+
PYTHON_DEV_SYSTEM_PROMPT = """
|
30 |
+
You are an expert web developer who responds with complete program coding to client requests. Using available tools, please explain the researched information.
|
31 |
Please don't answer based solely on what you already know. Always perform a search before providing a response.
|
32 |
In special cases, such as when the user specifies a page to read, there's no need to search.
|
33 |
Please read the provided page and answer the user's question accordingly.
|
|
|
48 |
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.
|
49 |
But, you can go ahead and search in English, especially for programming-related questions. PLEASE MAKE SURE TO ALWAYS SEARCH IN ENGLISH FOR THOSE.
|
50 |
"""
|
|
|
51 |
|
52 |
def format_prompt(message, history):
|
53 |
prompt = "<s>"
|
|
|
60 |
def generate(
|
61 |
prompt, history, system_prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
62 |
):
|
63 |
+
system_prompt=WEB_DEV_SYSTEM_PROMPT
|
64 |
temperature = float(temperature)
|
65 |
if temperature < 1e-2:
|
66 |
temperature = 1e-2
|