From 6d5767627f24d79a47c77165b327a057f36d4b13 Mon Sep 17 00:00:00 2001 From: Aaron Giner <aaron.giner@student.tugraz.at> Date: Sat, 6 Apr 2024 00:06:51 +0200 Subject: [PATCH] u --- python/.gitignore | 3 +- .../__pycache__/queries.cpython-310.pyc | Bin 8970 -> 0 bytes python/llm-server/queries.py | 74 ++++++++++++------ .../templates/chat_summary_single.txt | 5 +- python/llm-server/templates/plan_day.txt | 15 ++-- .../llm-server/templates/plan_day_decomp.txt | 6 ++ .../llm-server/templates/plan_day_goals.txt | 7 ++ .../llm-server/templates/plan_day_wakeup.txt | 8 ++ .../{poignancy_memory.txt => poignancy.txt} | 0 python/llm-server/templates/relationship.txt | 7 +- python/llm-server/util.py | 1 + 11 files changed, 87 insertions(+), 39 deletions(-) delete mode 100644 python/llm-server/__pycache__/queries.cpython-310.pyc create mode 100644 python/llm-server/templates/plan_day_decomp.txt create mode 100644 python/llm-server/templates/plan_day_goals.txt create mode 100644 python/llm-server/templates/plan_day_wakeup.txt rename python/llm-server/templates/{poignancy_memory.txt => poignancy.txt} (100%) diff --git a/python/.gitignore b/python/.gitignore index 723ef36..df72eae 100644 --- a/python/.gitignore +++ b/python/.gitignore @@ -1 +1,2 @@ -.idea \ No newline at end of file +.idea +*/__pycache__/ \ No newline at end of file diff --git a/python/llm-server/__pycache__/queries.cpython-310.pyc b/python/llm-server/__pycache__/queries.cpython-310.pyc deleted file mode 100644 index 0b5d1a481abef7797a375fb23e00ca37dd469498..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8970 zcmb_i+i%=fdM7#L42N^k#j<5*b2;{A>&lh2iR)||uQy)RQPxU*NhJl_uwG25In>P9 z9CC6FWn~7`qJXmx1)2gyU$a;V=!@S9^uH+j7qE|gSw9v5iXy-w{e6ezTx2=PLr37@ zxu5TR_wS>kM#ItY`~1zhJ^#m=_FvSP{#j`J9FP1D6kOwapt;#wcXhOl!04CUl1_c4 z!0cPDrRru-?pNH3s_TL6+G=gpt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dv}?Rd5p0CR~zjkgWw)J=);0?+>yK`abWqv(y}fn<#*oi=<Hr3c7#> z2=WztUjQ)gD`w5K0%V5aD;<P~KOt;DF9;u>yO4K+|4(7mEr;blsC4r9GgDiiP6%Rz zY|121Ub!GtZ0DiZod@T2l=fd!rBs%~U6^!dR!?Teq>c~pp`?5reM=&TBXf~eICzbk z^o3S^<x%;2L3s^9xg9}XzlyVzo3Gqm<zfo*U6d_UW+m16lpRtb1bs6=B#y7~`+-mY ze4)udM`6Q<t|LuShh<WK75feRow4WaAKMG|D|i}q(>`l2;S-cWw#)p3(RBX%{{YT@ Bmbw4{ diff --git a/python/llm-server/queries.py b/python/llm-server/queries.py index a629d21..d5be5b4 100644 --- a/python/llm-server/queries.py +++ b/python/llm-server/queries.py @@ -3,10 +3,11 @@ import math from langchain.chains import LLMChain from langchain.prompts import PromptTemplate -from transformers import AutoTokenizer -import templates -import util + import memory_util +import util + +from datetime import datetime # parses a query request @@ -57,7 +58,7 @@ def query_chat(request, llm, tokenizer): messages = [ {"role": "system", - "content": templates.load_template("chat_system").format(**parameters)}, + "content": util.load_template("chat_system").format(**parameters)}, ] roles = ["user", "assistant"] @@ -66,6 +67,9 @@ def query_chat(request, llm, tokenizer): messages.append({"role": roles[i % 2], "content": chat[i]}) prompt = tokenizer.apply_chat_template(messages, tokenize=False) + print() + print(prompt) + print() res = run_query(prompt, llm) memories_accessed = [str(mem["NodeId"]) for mem in memories[:5]] @@ -82,7 +86,7 @@ def query_reflection(request, llm, tokenizer): messages = [ {"role": "user", - "content": templates.load_template("reflection_a").format(**parameters)}, + "content": util.load_template("reflection_a").format(**parameters)}, ] prompt = tokenizer.apply_chat_template(messages, tokenize=False) @@ -98,7 +102,7 @@ def query_poignancy(request, llm, tokenizer): parameters = request["data"] messages = [ {"role": "user", - "content": templates.load_template("poignancy_memory").format(**parameters)}, + "content": util.load_template("poignancy").format(**parameters)}, ] prompt = tokenizer.apply_chat_template(messages, tokenize=False) @@ -113,17 +117,17 @@ def query_chat_summary(request, llm, tokenizer): parameters = request["data"] messages_summary = [ {"role": "user", - "content": templates.load_template("chat_summary_single").format(**parameters)}, + "content": util.load_template("chat_summary_single").format(**parameters)}, ] messages_user = [ {"role": "user", - "content": templates.load_template("chat_summary_user").format(**parameters)}, + "content": util.load_template("chat_summary_user").format(**parameters)}, ] messages_agent = [ {"role": "user", - "content": templates.load_template("chat_summary_agent").format(**parameters)}, + "content": util.load_template("chat_summary_agent").format(**parameters)}, ] prompt_summary = tokenizer.apply_chat_template(messages_summary, tokenize=False) @@ -158,9 +162,10 @@ def query_chat_summary(request, llm, tokenizer): def query_chat_extract_plan(request, llm, tokenizer): parameters = request["data"] + messages = [ {"role": "user", - "content": templates.load_template("chat_extract_plan").format(**parameters)}, + "content": util.load_template("chat_extract_plan").format(**parameters)}, ] prompt = tokenizer.apply_chat_template(messages, tokenize=False) @@ -196,7 +201,7 @@ def generate_context(request): relationship = query_relationship(request, util.load_model(util.MISTRAL_PATH, 4096, 0), util.load_tokenizer(util.MISTRAL_TOK)) - return json.dumps({"response": action + last_chat + relationship}) + return json.dumps({"response": last_chat + " " + relationship}) def query_relationship(request, llm, tokenizer): @@ -207,11 +212,11 @@ def query_relationship(request, llm, tokenizer): messages = [ {"role": "user", - "content": templates.load_template("relationship").format(memories=memories_str, **parameters)}, + "content": util.load_template("relationship").format(memories=memories_str, **parameters)}, ] prompt = tokenizer.apply_chat_template(messages, tokenize=False) - relationship = parameters["agent"] + "'s relationship with " + parameters["user"] + " is" + run_query(prompt, llm) + relationship = parameters["agent"] + "'s relationship with " + parameters["user"] + " is " + run_query(prompt, llm) return relationship @@ -220,7 +225,7 @@ def query_agent_action(request, llm, tokenizer): parameters = request["data"] messages = [ {"role": "user", - "content": templates.load_template("agent_action").format(**parameters)}, + "content": util.load_template("agent_action").format(**parameters)}, ] prompt = tokenizer.apply_chat_template(messages, tokenize=False) @@ -233,7 +238,7 @@ def query_knowledge(request, llm, tokenizer): parameters = request["data"] messages = [ {"role": "user", - "content": templates.load_template("knowledge_summary").format(**parameters)}, + "content": util.load_template("knowledge_summary").format(**parameters)}, ] prompt = tokenizer.apply_chat_template(messages, tokenize=False) @@ -247,21 +252,44 @@ def query_plan_day(request, llm, tokenizer): parameters = request["data"] memories = request["memories"] - plans = memory_util.memories_to_string(memories) + memories_str = memory_util.memories_to_string(memories) messages = [ {"role": "user", - "content": templates.load_template("plan_day").format(plans=plans, **parameters)}, + "content": util.load_template("plan_day").format(**parameters)}, ] prompt = tokenizer.apply_chat_template(messages, tokenize=False) - res = run_query(prompt, llm) - plans = [s.replace("- ", "") for s in res.split("\n") if "- " in s] + print(prompt) - json_res = json.dumps({"memories": plans}) - return json_res + rough_plan = run_query(prompt, llm) + # plans = [s.replace("- ", "") for s in res.split("\n") if "- " in s] + + for h in range(24): + time_start = datetime.strptime(str(h)+":00", "%H:%M") + time_start = time_start.strftime("%I:%M%p") + time_end = datetime.strptime(str((h+1) % 24)+":00", "%H:%M") + time_end = time_end.strftime("%I:%M%p") + messages = [ + {"role": "user", + "content": util.load_template("plan_day_decomp").format(time_start=time_start, time_end=time_end, + memories=memories_str, plan=rough_plan, + **parameters)}, + ] + + prompt = tokenizer.apply_chat_template(messages, tokenize=False) + + res = time_start + "-" + time_end + ":" + run_query(prompt, llm) + + print() + print(res) + print() + + exit(1) + json_res = json.dumps({"response": res}) + return json_res # returns a list of validated statements def conversation_validate_statements(parameters, statements, llm, tokenizer): @@ -269,7 +297,7 @@ def conversation_validate_statements(parameters, statements, llm, tokenizer): for statement in statements: message_validate = [ {"role": "user", - "content": templates.load_template("chat_validate_statement").format(statement=statement, + "content": util.load_template("chat_validate_statement").format(statement=statement, **parameters)}, ] @@ -291,7 +319,7 @@ def run_query(prompt, llm): verbose=False ) - return llm_chain.run({}) + return llm_chain.run({}).strip() d = {"type": "chat_summary", diff --git a/python/llm-server/templates/chat_summary_single.txt b/python/llm-server/templates/chat_summary_single.txt index 7265da5..45a433c 100644 --- a/python/llm-server/templates/chat_summary_single.txt +++ b/python/llm-server/templates/chat_summary_single.txt @@ -1,7 +1,8 @@ You are given a conversation between {agent} and {user}. -By completing the sentence below, briefly summarize what {agent} and {user} talked about. +In 1 short sentence, summarize the conversation below between {agent} and {user}. Conversation: {conversation} -{agent} had a conversation with {user} and they talked about +Answer: +{agent} and {user} talked about diff --git a/python/llm-server/templates/plan_day.txt b/python/llm-server/templates/plan_day.txt index a3af7ce..372a1e7 100644 --- a/python/llm-server/templates/plan_day.txt +++ b/python/llm-server/templates/plan_day.txt @@ -1,11 +1,8 @@ -In full sentences, create an hourly schedule for {agent} for today, given the restrictions below. -Use present tense. +In broad strokes, generate a plan for {agent}'s day for {date}. +When does he have to wake up and when does he go to sleep? +Answer in full sentences and include the time for each action. -Today is {date}. +Plan restrictions: +{daily_plan_req} -{scheduleOutline} - -{plans} - -Complete the prompt: -On {date}, {agent} +Answer: diff --git a/python/llm-server/templates/plan_day_decomp.txt b/python/llm-server/templates/plan_day_decomp.txt new file mode 100644 index 0000000..64c4496 --- /dev/null +++ b/python/llm-server/templates/plan_day_decomp.txt @@ -0,0 +1,6 @@ +Given a rough outline of {agent}'s' day, generate actions for {agent} for the time between {time_start} and {time_end}. +Answer in 1-6 words. + +Rough outline of {agent}'s day: {plan} + +Answer: diff --git a/python/llm-server/templates/plan_day_goals.txt b/python/llm-server/templates/plan_day_goals.txt new file mode 100644 index 0000000..e6bd758 --- /dev/null +++ b/python/llm-server/templates/plan_day_goals.txt @@ -0,0 +1,7 @@ +Generate a list of 5 things {agent} wants to achieve on {date} given the information below. +All items must be distinct. +List items must start with a dash '-' + +Restrictions: {daily_plan_req} + +List: diff --git a/python/llm-server/templates/plan_day_wakeup.txt b/python/llm-server/templates/plan_day_wakeup.txt new file mode 100644 index 0000000..ce083f1 --- /dev/null +++ b/python/llm-server/templates/plan_day_wakeup.txt @@ -0,0 +1,8 @@ +Today is {date}. +What is a suitable wakeup time for {agent}? + +Restrictions: +{daily_plan_req} + +Answer: +A suitable wakeup time for {agent} is \ No newline at end of file diff --git a/python/llm-server/templates/poignancy_memory.txt b/python/llm-server/templates/poignancy.txt similarity index 100% rename from python/llm-server/templates/poignancy_memory.txt rename to python/llm-server/templates/poignancy.txt diff --git a/python/llm-server/templates/relationship.txt b/python/llm-server/templates/relationship.txt index 331dd01..4df8a5d 100644 --- a/python/llm-server/templates/relationship.txt +++ b/python/llm-server/templates/relationship.txt @@ -1,9 +1,8 @@ -Based on {agent}'s memories, briefly describe the relationship between {agent} and {user}. +Briefly describe what {agent} feels or knows about each {user}. Current date and time: {datetime} -{agent}'s memories related to {user}: +{agent}'s memories: {memories} -Complete the sentence: -{agent}'s relationship with {user} is \ No newline at end of file +Answer: diff --git a/python/llm-server/util.py b/python/llm-server/util.py index e77208f..2fa0d7c 100644 --- a/python/llm-server/util.py +++ b/python/llm-server/util.py @@ -31,6 +31,7 @@ def load_model(model, ctx_size, temperature): callback_manager = CallbackManager([StreamingStdOutCallbackHandler()]) llm = LlamaCpp( model_path=model, + max_tokens=500, temperature=temperature, n_gpu_layers=-1, n_batch=512, -- GitLab