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.

271 lines
9.8 KiB

2 years ago
from langchain import PromptTemplate
2 years ago
2 years ago
prompt_pygmalion = PromptTemplate.from_template(
"""{ai_name}'s Persona: {persona}
2 years ago
Scenario: {scenario}
Summary of previous events: {summary}
2 years ago
<START>
{chat_history}
{human_name}: {input}
2 years ago
{ai_name_chat}:"""
2 years ago
)
2 years ago
2 years ago
prompt_koboldai = PromptTemplate.from_template(
"""[Character: {ai_name} {persona}]
2 years ago
[Start Scene: {scenario}]
{chat_history}
{human_name}: {input}
2 years ago
{ai_name_chat}:"""
2 years ago
)
2 years ago
2 years ago
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.
2 years ago
### 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}
2 years ago
{ai_name_chat}:"""
2 years ago
prompt_alpaca = PromptTemplate(
input_variables=["ai_name", "persona", "scenario", "chat_history", "human_name", "ai_name_chat", "input"],
2 years ago
template=template_alpaca,
)
2 years ago
2 years ago
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.
2 years ago
### 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.
2 years ago
### Input:
{ai_name}'s Persona: {persona}
Scenario: {scenario}
Summary of previous events:
{summary}
2 years ago
### Response:
2 years ago
Current conversation:
2 years ago
{chat_history}
2 years ago
{human_name}: {input}
2 years ago
{ai_name_chat}:"""
2 years ago
)
2 years ago
2 years ago
template_generic = """Roleplay the character {ai_name}, that is described in the following lines. You always stay in character.
2 years ago
{ai_name}'s Persona: {persona}
Scenario: {scenario}"
{chat_history}
{human_name}: {human_input}
{ai_name_chat}:"""
2 years ago
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.
2 years ago
### Instruction:
{instruction}
### Input:
{input}
### Response:
{output}"""
2 years ago
)
2 years ago
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}"""
)
2 years ago
template_question_simple = """Question: {question}
2 years ago
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_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:
2 years ago
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
2 years ago
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.
2 years ago
### 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}
"""
)
2 years ago
# 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:
2 years ago
# "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.
2 years ago
# 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"
2 years ago
#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.