Skip to main content

This library is designed to make the creation of characters for roll-play in ChatGPT much easier

Project description

CharacterGPT

This library is designed to make the creation of characters for rollplay in ChatGPT much easier

Installation

pip install charactergpt-prompts

Usage

Create character from scratch

from charactergpt_prompts.prompt_generator import GptPrompt

prompt_example=GptPrompt(**kwargs)

currently supported parameters:

  • jailbreak_type(str) #Use one of the premade jailbreaks

    • default
  • custom_jailbreak(str) #Pass your own jailbreak

  • character_description(dict) #Dictionary of character characteristics

    • Note: For better results, you should add "Name" and "Character information"
  • story_initial_message(str) #String containing the beginning of the story

  • story_start_context(str) #Context of the beginning of the story so model can better understands where she is

  • user_name(str) #Name of the character the user will play

    • Note: all {{user}} in character_description, story_initial_message and story_start_context will be replaced by this parameter
  • tokens_limit(int) #Limit the number of tokens to be generated

  • average_tokens(int) #Less strict token limit

  • debug_mode(bool) #Adds the ability for the user to update the behavior of the model during role-play

    • Note: to call debug mode simply write DebugMode: before changes that you want to make
  • model_author #Model author data

  • import_data(dict) #If this parameter passed it will try to load prompt data from it

Import existing character

from charactergpt_prompts.prompt_generator import GptPrompt

example_prompt=GptPrompt.import_existing_prompt(prompt_name="Sakura")
#or
example_prompt=GptPrompt.import_existing_prompt(filename="example.json")

Note: if you pass prompt_name as a parameter it will import character from character examples folder
List of "ready to go" characters:

  • Alys
  • Ami
  • Sakura

Update prompt parameters

from charactergpt_prompts.prompt_generator import GptPrompt

example_prompt=GptPrompt.import_existing_prompt(prompt_name="Sakura")

#update jailbreak message
example_prompt.jailbreak_text="new jailbreak text"

#character description
example_prompt.character_description["Name"]="Ami"

#or if you want to update multiple parameters
description_extension={
    "Age":"23",
    "Dislikes":["being rude", "sadness", "when {{user}} is angry"]
}
example_prompt.add_description_parameters(description_extension)

#initial message
example_prompt.initial_message="new initial message"

#story start context
example_prompt.story_start_context="new story start context"

#user name
example_prompt.user_name="New user"

#tokens limit
example_prompt.tokens_limit=100
#avarage tokens
example_prompt.average_tokens=150

#debug mode
example_prompt.debug_mode=True

#model author
example_prompt.model_author="New model author"

Export prompt as txt

print(prompt_example.generate_prompt())
#or
prompt_example.generate_prompt_and_save_to_file("example.txt")

Export prompt as json

prompt_example.export_prompt("example.json")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

charactergpt-prompts-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

File details

Details for the file charactergpt-prompts-0.1.0.tar.gz.

File metadata

  • Download URL: charactergpt-prompts-0.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.7

File hashes

Hashes for charactergpt-prompts-0.1.0.tar.gz
Algorithm Hash digest
SHA256 59cbacacd69f50bb03ae98661ceef5af641914980919eacba6ee4d67ffa8024e
MD5 d26c70f0250bd50b13c677a78105571b
BLAKE2b-256 1a1a85291168775dbbc9f6e9acf8171bfa8fc60f67b75f29731435ec8e65dfda

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page