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.
 
 
 
 

182 lines
6.7 KiB

from langchain import PromptTemplate
prompt_pygmalion = PromptTemplate.from_template(
"""{ai_name}'s Persona: {persona}
Scenario: {scenario}
<START>
{chat_history}
{human_name}: {human_input}
{ai_name_chat}:"""
)
prompt_koboldai = PromptTemplate.from_template(
"""[Character: {ai_name} {persona}]
[Start Scene: {scenario}]
{chat_history}
{human_name}: {human_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}: {human_input}
{ai_name_chat}:"""
prompt_alpaca = PromptTemplate(
input_variables=["ai_name", "persona", "scenario", "chat_history", "human_name", "ai_name_chat", "human_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}:"""
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}"""
)
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_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.
# 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:
# 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"
#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.