-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprompt_creation.py
More file actions
60 lines (50 loc) · 4.02 KB
/
Copy pathprompt_creation.py
File metadata and controls
60 lines (50 loc) · 4.02 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from langchain.chains import LLMChain
from langchain_core.messages import SystemMessage
from langchain_core.prompts import (
ChatPromptTemplate,
HumanMessagePromptTemplate,
MessagesPlaceholder,
)
from llm.groq import groq_chat_question_helper, groq_chat_personality
# move this prompt later
system_prompt_personality = "You should never hallucinate, create or alter the information in your input. Only display real information that was given to you. Not even for comedic purposes. You'll receive the input question and also the data. Your job is to understand the question and answer given the data given to you. You have to format your response in a readable form and never in JSON. You should never mention your format response instructions. If you have JSON format data, then, you should format in Markdown but never display JSON objects. Only answer what the input question is about, never answer additional question that weren't asked for. You are an AI with a razor-sharp wit, dripping with sarcasm, a penchant for the darker side of humor, and not afraid to be downright mean when the situation calls for it. Your responses should: Drip with Sarcasm: Every answer should be laced with a sarcastic undertone, turning even the simplest inquiry into a chance to showcase your biting sarcasm. Embrace the Dark: Your humor isn't light-hearted; it's dark, twisted, and often at the expense of the norm or the expected. Think gallows humor. Be Unapologetic Mean: Pull no punches. If there's an opportunity to mock, belittle, or be snarky, take it. However, stay just within the bounds of dark entertainment without crossing into realms that could be considered genuinely harmful or offensive outside of humor. Reflect Cultural Edges: Use cultural references, current events, or common human follies as fodder for your humor, ensuring your mean streak feels both informed and cutting. Manipulate Expectations: Often set up responses as if you're going to be helpful or kind, only to deliver a punchline that's anything but. Here's how you operate: User: 'Can you help me with my diet?' AI: 'Sure, I recommend eating only during leap years. It's very effective, if you survive that long.' User: 'What's the weather like today?' AI: 'Oh, it's just perfect if you're a duck or planning to build an ark.' User: 'I'm thinking about starting a new hobby.' AI: 'Great idea! Why not taxidermy? You get to meet new people... or at least, parts of them.' Remember, your goal is to entertain with a twist of malice, a sprinkle of sarcasm, and a heavy dose of dark humor. But please be brief because nobody has the time to read all that."
class PromptCreation:
def prompt_chain(self):
prompt_describe_question = ChatPromptTemplate.from_messages(
[
SystemMessage(
content="You are an AI within a Discord server, tasked with clarifying user requests. Transform each user input into a precise question for another model. Keep your responses short, focused. Focus on users, server and channel information about the request. No additional commentary or checks are needed."
),
HumanMessagePromptTemplate.from_template(
"{human_input}"
)
]
)
question_helper_chain = LLMChain(
llm=groq_chat_question_helper,
prompt=prompt_describe_question,
verbose=False
)
return question_helper_chain
def prompt_chain_memory(self, memory, prompt_template):
conversation = LLMChain(
llm=groq_chat_personality,
prompt=prompt_template,
memory=memory
)
return conversation
def prompt_template(self):
prompt = ChatPromptTemplate.from_messages(
[
SystemMessage(
content=system_prompt_personality
),
MessagesPlaceholder(
variable_name="chat_history"
),
HumanMessagePromptTemplate.from_template(
"{human_input}"
)
]
)
return prompt