Spaces:
Running
Running
broadfield
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -28,7 +28,11 @@ clients = [
|
|
28 |
{'type':'text','name':'meta-llama/Llama-3.3-70B-Instruct','rank':'pro','max_tokens':16384,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
29 |
{'type':'text','name':'mistralai/Mixtral-8x7B-Instruct-v0.1','rank':'op','max_tokens':40000,'schema':{'bos':'<s>','eos':'</s>'}},
|
30 |
]
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
def format_prompt(message, mod, system):
|
33 |
eos=f"{clients[int(mod)]['schema']['eos']}\n"
|
34 |
bos=f"{clients[int(mod)]['schema']['bos']}\n"
|
@@ -63,7 +67,7 @@ def generate(prompt,history,mod=2,tok=4000,seed=1,role="ASSISTANT",data=None):
|
|
63 |
system_prompt = prompts.PATH_MAKER.replace("**CURRENT_OR_NONE**",str(data[4])).replace("**PROMPT**",json.dumps(data[0],indent=4)).replace("**HISTORY**",str(history))
|
64 |
formatted_prompt = format_prompt(prompt, mod, system_prompt)
|
65 |
elif role == "CREATE_FILE":
|
66 |
-
system_prompt = prompts.CREATE_FILE.replace("**TIMELINE**",data[4]).replace("**FILENAME**",str(data[1]))
|
67 |
formatted_prompt = format_prompt(prompt, mod, system_prompt)
|
68 |
elif role == "SEARCH":
|
69 |
system_prompt = prompts.SEARCH.replace("**DATA**",data)
|
@@ -252,6 +256,8 @@ def agent(prompt_in,history,mod=2):
|
|
252 |
if 'CREATE_FILE' in fn:
|
253 |
print('CREATE_FILE called')
|
254 |
in_data[1]=com
|
|
|
|
|
255 |
out_o =generate(prompt,history,mod=mod,tok=10000,seed=seed,role="CREATE_FILE",data=in_data)
|
256 |
out_w=list(out_o)
|
257 |
ret1,ret2 = parse_json(out_w[2].split('<|im_end|>')[0])
|
|
|
28 |
{'type':'text','name':'meta-llama/Llama-3.3-70B-Instruct','rank':'pro','max_tokens':16384,'schema':{'bos':'<|im_start|>','eos':'<|im_end|>'}},
|
29 |
{'type':'text','name':'mistralai/Mixtral-8x7B-Instruct-v0.1','rank':'op','max_tokens':40000,'schema':{'bos':'<s>','eos':'</s>'}},
|
30 |
]
|
31 |
+
def file_template(inp):
|
32 |
+
if "readme.md" in inp.lower():
|
33 |
+
template=prompts.README
|
34 |
+
else:template="NONE"
|
35 |
+
return template
|
36 |
def format_prompt(message, mod, system):
|
37 |
eos=f"{clients[int(mod)]['schema']['eos']}\n"
|
38 |
bos=f"{clients[int(mod)]['schema']['bos']}\n"
|
|
|
67 |
system_prompt = prompts.PATH_MAKER.replace("**CURRENT_OR_NONE**",str(data[4])).replace("**PROMPT**",json.dumps(data[0],indent=4)).replace("**HISTORY**",str(history))
|
68 |
formatted_prompt = format_prompt(prompt, mod, system_prompt)
|
69 |
elif role == "CREATE_FILE":
|
70 |
+
system_prompt = prompts.CREATE_FILE.replace("**TIMELINE**",data[4]).replace("**FILENAME**",str(data[1])).replace("**TEMPLATE_OR_NONE**",str(data[2]))
|
71 |
formatted_prompt = format_prompt(prompt, mod, system_prompt)
|
72 |
elif role == "SEARCH":
|
73 |
system_prompt = prompts.SEARCH.replace("**DATA**",data)
|
|
|
256 |
if 'CREATE_FILE' in fn:
|
257 |
print('CREATE_FILE called')
|
258 |
in_data[1]=com
|
259 |
+
temp1=file_template(com)
|
260 |
+
in_data[2]
|
261 |
out_o =generate(prompt,history,mod=mod,tok=10000,seed=seed,role="CREATE_FILE",data=in_data)
|
262 |
out_w=list(out_o)
|
263 |
ret1,ret2 = parse_json(out_w[2].split('<|im_end|>')[0])
|