OpenAI run and some fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
base_the_ville_isabella_maria_klaus
|
||||
test-simulation
|
||||
run 1
|
||||
run 6000
|
||||
fin
|
||||
|
||||
Binary file not shown.
@@ -423,13 +423,13 @@ def revise_identity(persona):
|
||||
plan_prompt += f" *{persona.scratch.curr_time.strftime('%A %B %d')}*? "
|
||||
plan_prompt += f"If there is any scheduling information, be as specific as possible (include date, time, and location if stated in the statement)\n\n"
|
||||
plan_prompt += f"Write the response from {p_name}'s perspective."
|
||||
plan_note = GPT_single_request(plan_prompt)
|
||||
plan_note = ChatGPT_single_request(plan_prompt)
|
||||
# print (plan_note)
|
||||
|
||||
thought_prompt = statements + "\n"
|
||||
thought_prompt += f"Given the statements above, how might we summarize {p_name}'s feelings about their days up to now?\n\n"
|
||||
thought_prompt += f"Write the response from {p_name}'s perspective."
|
||||
thought_note = GPT_single_request(thought_prompt)
|
||||
thought_note = ChatGPT_single_request(thought_prompt)
|
||||
# print (thought_note)
|
||||
|
||||
currently_prompt = f"{p_name}'s status from {(persona.scratch.curr_time - datetime.timedelta(days=1)).strftime('%A %B %d')}:\n"
|
||||
@@ -441,7 +441,7 @@ def revise_identity(persona):
|
||||
currently_prompt += "Follow this format below:\nStatus: <new status>"
|
||||
# print ("DEBUG ;adjhfno;asdjao;asdfsidfjo;af", p_name)
|
||||
# print (currently_prompt)
|
||||
new_currently = GPT_single_request(currently_prompt)
|
||||
new_currently = ChatGPT_single_request(currently_prompt)
|
||||
# print (new_currently)
|
||||
# print (new_currently[10:])
|
||||
|
||||
@@ -452,7 +452,7 @@ def revise_identity(persona):
|
||||
daily_req_prompt += f"Follow this format (the list should have 4~6 items but no more):\n"
|
||||
daily_req_prompt += f"1. wake up and complete the morning routine at <time>, 2. ..."
|
||||
|
||||
new_daily_req = GPT_single_request(daily_req_prompt)
|
||||
new_daily_req = ChatGPT_single_request(daily_req_prompt)
|
||||
new_daily_req = new_daily_req.replace('\n', ' ')
|
||||
print ("WE ARE HERE!!!", new_daily_req)
|
||||
persona.scratch.daily_plan_req = new_daily_req
|
||||
|
||||
@@ -19,10 +19,10 @@ else:
|
||||
model = GPT4All("mistral-7b-instruct-v0.1.Q4_0.gguf", device="gpu", n_threads=4)
|
||||
embedder = Embed4All()
|
||||
|
||||
def temp_sleep(seconds=0.1):
|
||||
def temp_sleep(seconds=3.0):
|
||||
time.sleep(seconds)
|
||||
|
||||
def GPT_single_request(prompt):
|
||||
def ChatGPT_single_request(prompt):
|
||||
temp_sleep()
|
||||
|
||||
if use_openai:
|
||||
@@ -67,7 +67,7 @@ def GPT_single_request(prompt):
|
||||
# return "ChatGPT ERROR"
|
||||
|
||||
|
||||
def GPT_request(prompt):
|
||||
def ChatGPT_request(prompt):
|
||||
"""
|
||||
Given a prompt and a dictionary of GPT parameters, fetch the response of the LLM
|
||||
ARGS:
|
||||
@@ -75,7 +75,7 @@ def GPT_request(prompt):
|
||||
RETURNS:
|
||||
a str of the LLM's response.
|
||||
"""
|
||||
# temp_sleep()
|
||||
temp_sleep()
|
||||
try:
|
||||
if use_openai:
|
||||
completion = openai.ChatCompletion.create(
|
||||
@@ -152,9 +152,10 @@ def ChatGPT_safe_generate_response(prompt,
|
||||
for i in range(repeat):
|
||||
|
||||
try:
|
||||
curr_gpt_response = GPT_request(prompt).strip()
|
||||
curr_gpt_response = ChatGPT_request(prompt).strip()
|
||||
end_index = curr_gpt_response.rfind('}') + 1
|
||||
curr_gpt_response = curr_gpt_response[:end_index]
|
||||
|
||||
curr_gpt_response = json.loads(curr_gpt_response)["output"]
|
||||
|
||||
# print ("---ashdfaf")
|
||||
@@ -187,7 +188,7 @@ def ChatGPT_safe_generate_response_OLD(prompt,
|
||||
|
||||
for i in range(repeat):
|
||||
try:
|
||||
curr_gpt_response = GPT_request(prompt).strip()
|
||||
curr_gpt_response = ChatGPT_request(prompt).strip()
|
||||
if func_validate(curr_gpt_response, prompt=prompt):
|
||||
return func_clean_up(curr_gpt_response, prompt=prompt)
|
||||
if verbose:
|
||||
|
||||
Reference in New Issue
Block a user