suhamemon1
commited on
Commit
•
362c439
1
Parent(s):
32bdf7b
updated chatbot
Browse files- __pycache__/experiment_details.cpython-311.pyc +0 -0
- __pycache__/model_generate.cpython-311.pyc +0 -0
- __pycache__/utils.cpython-311.pyc +0 -0
- data/problems/p_email8.md +1 -1
- model_generate.py +1 -2
- utils.py +10 -15
__pycache__/experiment_details.cpython-311.pyc
CHANGED
Binary files a/__pycache__/experiment_details.cpython-311.pyc and b/__pycache__/experiment_details.cpython-311.pyc differ
|
|
__pycache__/model_generate.cpython-311.pyc
CHANGED
Binary files a/__pycache__/model_generate.cpython-311.pyc and b/__pycache__/model_generate.cpython-311.pyc differ
|
|
__pycache__/utils.cpython-311.pyc
CHANGED
Binary files a/__pycache__/utils.cpython-311.pyc and b/__pycache__/utils.cpython-311.pyc differ
|
|
data/problems/p_email8.md
CHANGED
@@ -1 +1 @@
|
|
1 |
-
### You have noticed your colleague often schedules meetings and cancels at the last minute, which has been frustrating for you. Write an email to
|
|
|
1 |
+
### You have noticed that your colleague, William, often schedules meetings and cancels at the last minute, which has been frustrating for you. Write an email to William, expressing your feelings clearly and respectfully.
|
model_generate.py
CHANGED
@@ -29,13 +29,12 @@ def query_a_chat_completion(model, messages):
|
|
29 |
|
30 |
|
31 |
def query_chatbot(model, messages):
|
|
|
32 |
assert model in ["gpt-3.5-turbo", "gpt-4"]
|
33 |
chat_completion = client.chat.completions.create(
|
34 |
messages=messages,
|
35 |
model="gpt-3.5-turbo",
|
36 |
-
|
37 |
)
|
38 |
-
|
39 |
return chat_completion.choices[0].message.content
|
40 |
|
41 |
|
|
|
29 |
|
30 |
|
31 |
def query_chatbot(model, messages):
|
32 |
+
print(messages)
|
33 |
assert model in ["gpt-3.5-turbo", "gpt-4"]
|
34 |
chat_completion = client.chat.completions.create(
|
35 |
messages=messages,
|
36 |
model="gpt-3.5-turbo",
|
|
|
37 |
)
|
|
|
38 |
return chat_completion.choices[0].message.content
|
39 |
|
40 |
|
utils.py
CHANGED
@@ -318,24 +318,19 @@ def generate_assisted_question(question_prompt, next_q_btn, q_num, question_answ
|
|
318 |
word_count: gr.Textbox(string_num)
|
319 |
}
|
320 |
|
321 |
-
initial_user_message = "You are
|
322 |
-
"
|
323 |
-
"
|
324 |
-
"
|
325 |
-
"
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
initial_conversation = [
|
330 |
-
# initial_user_message,
|
331 |
-
# "AI: As a writing assistant, my goal is to help you with your writing task."
|
332 |
-
]
|
333 |
with gr.Column() as chatbot_col:
|
334 |
-
chatbot = gr.Chatbot(
|
335 |
# Chat state
|
336 |
-
state = gr.State(
|
337 |
-
# Model state
|
338 |
initial_usr_msg_state = gr.State(initial_user_message)
|
|
|
339 |
model_state = gr.State("chatgpt")
|
340 |
with gr.Column() as chat_feature:
|
341 |
with gr.Group():
|
|
|
318 |
word_count: gr.Textbox(string_num)
|
319 |
}
|
320 |
|
321 |
+
initial_user_message = "You are a helpful writing assistant. You provide useful responses to writers’ questions. " \
|
322 |
+
"Here, writers will ask you questions about a specific writing task. " \
|
323 |
+
"You may only provide at most three sentences if the writer asks you to write an answer to the entire task for them. " \
|
324 |
+
"Your goal is to assist the writer but not do all the work. " \
|
325 |
+
"Here are the task-specific "+ instruction_txt + " " + prompt_txt
|
326 |
+
|
327 |
+
conversations_list = []
|
|
|
|
|
|
|
|
|
|
|
328 |
with gr.Column() as chatbot_col:
|
329 |
+
chatbot = gr.Chatbot(conversations_list, height=300, label="Writing Helper")
|
330 |
# Chat state
|
331 |
+
state = gr.State(conversations_list)
|
|
|
332 |
initial_usr_msg_state = gr.State(initial_user_message)
|
333 |
+
# Model state
|
334 |
model_state = gr.State("chatgpt")
|
335 |
with gr.Column() as chat_feature:
|
336 |
with gr.Group():
|