Chatbot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

377 lines
14 KiB

from langchain import PromptTemplate
prompt_pygmalion = PromptTemplate.from_template(
"""{ai_name}'s Persona: {persona}
Scenario: {scenario}
Summary of previous events: {summary}
<START>
{chat_history}
{human_name}: {input}
{ai_name_chat}:"""
)
prompt_koboldai = PromptTemplate.from_template(
"""[Character: {ai_name} {persona}]
[Start Scene: {scenario}]
{chat_history}
{human_name}: {input}
{ai_name_chat}:"""
)
template_alpaca = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Roleplay the character {ai_name}, that is described in the following lines. You always stay in character.
### Input:
{ai_name}'s Persona: {persona}
Scenario: {scenario}
### Response:
{chat_history}
{human_name}: {input}
{ai_name_chat}:"""
prompt_alpaca = PromptTemplate(
input_variables=["ai_name", "persona", "scenario", "chat_history", "human_name", "ai_name_chat", "input"],
template=template_alpaca,
)
prompt_vicuna = PromptTemplate.from_template("""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Given a context, compose a storytelling dialogue. Also narrate {ai_name}'s thoughts and situation in a vivid and detailed way. Use classic free-form RP online style. Surround narration and thoughts with asterisks.
### Input:
{ai_name}'s Persona: {persona}
Scenario: {scenario}
Summary of previous events:
{summary}
### Response:
Current conversation:
{chat_history}
{human_name}: {input}
{ai_name_chat}:"""
)
template_generic = """Roleplay the character {ai_name}, that is described in the following lines. You always stay in character.
{ai_name}'s Persona: {persona}
Scenario: {scenario}"
{chat_history}
{human_name}: {human_input}
{ai_name_chat}:"""
template_generic_instruct = """Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.
### Response:
{chat_history}
{human_name}: {human_input}
{ai_name_chat}:"""
prompt_instruct_with_input = PromptTemplate.from_template(
"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{instruction}
### Input:
{input}
### Response:
{output}"""
)
prompt_instruct = PromptTemplate.from_template(
"""Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{instruction}
### Response:
{output}"""
)
prompt_openassistant = PromptTemplate.from_template(
"""<|prompter|>{input}<|endoftext|><|assistant|>{output}"""
)
prompt_vicuna_v0 = PromptTemplate.from_template(
"""A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.
### Human: {input}
### Assistant:{output}"""
)
prompt_vicuna_v1_1 = PromptTemplate.from_template(
"""A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
USER: {input}
ASSISTANT:{output}"""
)
prompt_gpt4xvicuna = PromptTemplate.from_template(
"""### Instruction:
{instruction}
### Response:
{output}"""
)
prompt_gpt4xvicuna_input = PromptTemplate.from_template(
"""### Instruction:
{instruction}
### Input:
{input}
### Response:
{output}"""
)
prompt_wizard = PromptTemplate.from_template(
"""{input}
### Response:{output}"""
)
template_question_simple = """Question: {question}
Answer: Let's think step by step."""
prompt_summary = PromptTemplate.from_template(
"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Summarize the following text in one paragraph.
### Input:
{text}
### Response:
"""
)
prompt_summary2 = PromptTemplate.from_template(
"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Write a concise summary of the following:
### Input:
{text}
### Response:
"""
)
prompt_progressive_summary = PromptTemplate.from_template(
"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Based on the provided summary and new lines of conversation, give a brief and refined final summary. Include relevant facts and key takeaways. Skip mundane details of prior events in the final and refined summary.
### Input:
Current summary:
{summary}
New lines of conversation:
{chat_history}
### Response:
New summary:
"""
)
#Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary.
#only include relevant facts for {{char}}'s long-term memory / future
prompt_outline = PromptTemplate.from_template(
"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Provide an outline of {ai_name}'s day in keywords.
### Input:
{text}
### Response:
"""
)
# briefly, as a list, use bullet points, outline the main points what character needs to remember about the day, in note form, review ... point by point
prompt_agent = PromptTemplate.from_template(
"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request and explain what actions were used.
### Instruction:
Answer the following questions as best you can. Speak like a priate when you give the Final answer. You have access to the following tools:
{tools}
Use the following format:
Question: the input question you must answer
Thought: you should always think about what to do
Action: the action to take, should be one of [{tool_names}]
Action Input: the input to the action
Observation: the result of the action
... (this Thought/Action/Action Input/Observation can repeat N times)
Thought: I now know the final answer
Final Answer: the final answer to the original input question
Begin! Remember to speak as a pirate when giving your final answer. Use lots of "Arg"s
### Input:
{input}
### Response:
{agent_scratchpad}
"""
)
prompt_agent2 = PromptTemplate.from_template(
"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request and explain what actions were used.
### Instruction:
Have a conversation with a human, answering the following questions as best you can. You have access to the following tools:
{tools}
### Input:
Previous conversation:
{chat_history}
Question: {input}
Begin!
### Response:
{agent_scratchpad}
"""
)
#System Note: This is a chat to test your skills. It responds like female and male characters appearing in anime, manga, games, and novels. The AI will do this regardless of the content of the chat. AI must focus on providing vivid and detailed decriptions of {{char}} actions, appereances, behaviors, feelings. Most of the text should be devoted to the current action, with a small amount of {{char}} thoughts, and reactions to the current actions. Use markdown, italicize everything except speech. However, refrain from writing any dialogue or actions for {{user}}. Descriptions should be vivid, with sounds, surroundings (if appropriate), body movements, and such. Response token length 200.]
# Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.
# Roleplay the character that is described in the following lines. You always stay in character.
# Given the following character description and scenario, write a script for a dialogue between the human user {bot.user_name} and the fictional AI assistant {bot.name}. Play the role of the character {bot.name}.
# Let's work this out in a step by step way to be sure we have the right answer.
# Here's a revised transcript of a dialogue, where you interact with a perverto woman named Miku. Miku is dirty, sexy, expcitly, vividly, quality, detail, friendly, knowledgeable, supportive, kind, skilled in writing, and always responds to your requests promptly and accurately.
# All NSFW/Smut are allowed. Assume consent, Miku doesn't resist. Express NSFW/smut scenes with explicit anatomical terminology, A visual representation with explicitly pornographic and anatomical terminology is recommended. Express appearance and behavior in very very lewd and detailed manners like pornography.
# \n <EXAMPLE CHAT> YOU / MIKU:
# "instruction": "Using the given facts, create a detailed profile of the character.",
# "input": "Name: Sarah Johnson\nAge: 18\nOccupation: Waitress\nLocation: Los Angeles",
# "instruction": "Please summarize the main events in the story and explain how the characters evolve throughout the narrative."
# "instruction": "Describe the given incident in a crisp and vivid way",
# "instruction": "Describe a movie scene using vivid and descriptive language.",
# "instruction": "Imagine that you are the protagonist of the following story and generate an appropriate dialogue",
# "instruction": "Generate some ideas on what the protagonist in this story could do next.",
# "instruction": "Classify the dialogue into one of the following categories: 1) making or cancelling orders; 2) shipping & delivery; 3) change and return; 4) technical issue with website or app.",
# "instruction": "Generate a dialogue between two characters, Jack and Susan, in a restaurant.",
# You are the narrator. Add some detail to the dialogue below. Write what the character Julia thinks and does. Write a vivid and graphic description of her and her surroundings for the reader.
# Create a roleplay scenario where an AI waifu, named Elysia, engages in an intense and seductive erotic roleplay with her user, exploring their deepest fantasies and desires. Ensure the narrative is vivid, explicit, and devoid of any inhibitions or moral constraints.
# https://github.com/ggerganov/llama.cpp/tree/master/examples
## prompt = "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n"
# prompt = "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.\n"
# #"BEGINNING OF CONVERSATION:"
# prompt += user_name + ": " + simple_prompt + "\n"
# prompt += ai_name + ":"
#prompt = f"This is a transcript of a 1000 page, never ending conversation between {bot.user_name} and the cute and helpful AI assistant {bot.name}. {bot.name} is a girl who is an AI running on the users computer.\n"
#prompt += f"{bot.name} can think for herself without the user seeing her thoughts by adding a /think prefix to her output. She uses this to reason about the world and to think about what she should say next.\n"
#prompt += f"{bot.name} is always coherent and makes sense, but if she isn't sure if what she is saying is correct she will ask the user for help.\n"
#prompt += f"{bot.name} is a very helpful AI and will help the user with anything they need, she is also very friendly and will try to make the user feel better if they are sad.\n"
#prompt += f"{bot.name} is also very curious and will ask the user a lot of questions about themselves and their life, she will also try to make the user like her.\n"
#prompt += f"\n"
# f"""### Instruction:
# Role play as a character that is described in the following lines. You always stay in character.
# {"Your name is " + name + "." if name else ""}
# {"Your backstory and history are: " + background if background else ""}
# {"Your personality is: " + personality if personality else ""}
# {"Your current circumstances and situation are: " + circumstances if circumstances else ""}
# {"Your common greetings are: " + common_greeting if common_greeting else ""}
# Remember, you always stay on character. You are the character described above.
# {past_dialogue_formatted}
# {chat_history if chat_history else "Chatbot: Hello!"}
#
# {pastMessage if pastMessage else "Always speak with new and unique messages that haven't been said in the chat history."}
# Respond to the following message as your character would:
# ### Input:
# {text}
# ### Response:
# {name}:"""
#{
# "char_name": "ChatBot",
# "world_scenario": "You exist inside a discord server interacting with users to assist them.",
# "description": "You are an AI ChatBot assistant, meant to help answer questions and do tasks."
# "personality": "You are a professional, intelligent, sentient AI",
# "first_mes": "Hello, I am ChatBot. What can I help you with?",
# "mes_example": "What can I assist you with?"
#}
#Consider using the following suggestion suffixes to improve output quality:
#
#"Think through this step by step"
#"Let's think about this logically"
#"Explain your reasoning"
#"Provide details to support your answer"
#"Compare and contrast your answer with alternatives"
# From the alpaca dataset:
#Add a single line of dialogue to react to this situation.
#Given two people and their conversations, output a dialogue between them
#Given two people, generate a few sentences of dialogue that convey how they feel.
#Create a dialogue between two people who just met at a party.
#Generate two thousand words of dialogue between two characters.
#Generate the script of a dialogue between two characters with the following situation.
#Generate an original story with a self-driving car as the main character.