Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,15 +56,15 @@ def generate(prompt,history,mod=2,tok=4000,seed=1,role="ASSISTANT",data=None):
|
|
| 56 |
word_dict.close()
|
| 57 |
else:
|
| 58 |
lod=[]
|
| 59 |
-
if role == "
|
| 60 |
-
system_prompt = prompts.
|
| 61 |
-
formatted_prompt = format_prompt(
|
|
|
|
|
|
|
|
|
|
| 62 |
elif role == "CREATE_FILE":
|
| 63 |
system_prompt = prompts.CREATE_FILE.replace("**FILENAME**",str(data[4]))
|
| 64 |
formatted_prompt = format_prompt(prompt, mod, system_prompt)
|
| 65 |
-
elif role == "MANAGER":
|
| 66 |
-
system_prompt = prompts.MANAGER.replace("**TIMELINE**",data[4]).replace("**HISTORY**",str(history))
|
| 67 |
-
formatted_prompt = format_prompt(prompt, mod, system_prompt)
|
| 68 |
elif role == "SEARCH":
|
| 69 |
system_prompt = prompts.SEARCH.replace("**DATA**",data)
|
| 70 |
formatted_prompt = format_prompt(f'USER:{prompt}', mod, system_prompt)
|
|
@@ -89,7 +89,8 @@ def generate(prompt,history,mod=2,tok=4000,seed=1,role="ASSISTANT",data=None):
|
|
| 89 |
yield output
|
| 90 |
yield history
|
| 91 |
yield prompt
|
| 92 |
-
|
|
|
|
| 93 |
print("Runnning ", role)
|
| 94 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=True)
|
| 95 |
#prompt=f"We just completed role:{role}, now choose the next tool to complete the task:{prompt}, or COMPLETE"
|
|
@@ -99,6 +100,7 @@ def generate(prompt,history,mod=2,tok=4000,seed=1,role="ASSISTANT",data=None):
|
|
| 99 |
yield output
|
| 100 |
yield history
|
| 101 |
yield prompt
|
|
|
|
| 102 |
elif role=="CREATE_FILE":
|
| 103 |
print("Running Create File")
|
| 104 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=True)
|
|
|
|
| 56 |
word_dict.close()
|
| 57 |
else:
|
| 58 |
lod=[]
|
| 59 |
+
if role == "MANAGER":
|
| 60 |
+
system_prompt = prompts.MANAGER.replace("**TIMELINE**",data[4]).replace("**HISTORY**",str(history))
|
| 61 |
+
formatted_prompt = format_prompt(prompt, mod, system_prompt)
|
| 62 |
+
elif role == "PATHMAKER":
|
| 63 |
+
system_prompt = prompts.PATH_MAKER.replace("**CURRENT_OR_NONE**",str(data[4])).replace("**CODE_FILES**",json.dumps(data[0],indent=4)).replace("**HISTORY**",str(history))
|
| 64 |
+
formatted_prompt = format_prompt(prompt, history, system_prompt)
|
| 65 |
elif role == "CREATE_FILE":
|
| 66 |
system_prompt = prompts.CREATE_FILE.replace("**FILENAME**",str(data[4]))
|
| 67 |
formatted_prompt = format_prompt(prompt, mod, system_prompt)
|
|
|
|
|
|
|
|
|
|
| 68 |
elif role == "SEARCH":
|
| 69 |
system_prompt = prompts.SEARCH.replace("**DATA**",data)
|
| 70 |
formatted_prompt = format_prompt(f'USER:{prompt}', mod, system_prompt)
|
|
|
|
| 89 |
yield output
|
| 90 |
yield history
|
| 91 |
yield prompt
|
| 92 |
+
|
| 93 |
+
elif role=="PATHMAKER":
|
| 94 |
print("Runnning ", role)
|
| 95 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=True)
|
| 96 |
#prompt=f"We just completed role:{role}, now choose the next tool to complete the task:{prompt}, or COMPLETE"
|
|
|
|
| 100 |
yield output
|
| 101 |
yield history
|
| 102 |
yield prompt
|
| 103 |
+
|
| 104 |
elif role=="CREATE_FILE":
|
| 105 |
print("Running Create File")
|
| 106 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=True)
|