-
Notifications
You must be signed in to change notification settings - Fork 1
/
LLM.py
39 lines (31 loc) · 948 Bytes
/
LLM.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
File where we will prompt LLM to get user intent and return the fns
"""
import asyncio
from palm import handle_chat
# Give PaLM the users command -> PaLM decides on a list of actions to run
async def get_program_name(name: str, program_list: list) -> str:
prompt=f"""
Here are a list of programs on the user's computer.
{program_list}
Return the program name from the list above that most closely matches {name}
"""
print(prompt)
resp = await handle_chat(prompt)
resp = resp["response"]
return resp
from prompts import user_command_intent_prompt
async def get_user_actions(user_command:str) -> list:
prompt=f"""
{user_command_intent_prompt}
User: {user_command}
PaLM:
"""
print(prompt)
resp = await handle_chat(prompt)
resp = resp["response"]
return resp
if __name__ == "__main__":
user_command = "Open firefox"
resp = asyncio.run(get_user_actions(user_command))
print(resp)