Using Realmplay API with SillyTavern

Getting SillyTavern

SillyTavern is an open source project. The homepage is:

https://github.com/SillyTavern/SillyTavern/releases

However, if you want to run it properly and keep it updated, it’s a good idea to get it via git directly. This can be intimidating, but it is ultimately simple. First, install git.

If you are using Windows:

https://git-scm.com/downloads

Once git is installed, open the Git GUI. You can do this by rightclicking in any folder.

Choose “Clone Existing Respsitory”

Fill out the boxes as show for source and target and click “Clone”. Note: the target directory can be any folder you choose, but it must be one that you have not yet created.

Once the process completes, you can close the Git GUI. Open your destination folder and you will see the complete files of the SillyTavern app. You can run start.bat or UpdateAndStart.bat to start the application. UpdateAndStart is a good habit as SillyTavern is regularly updated with new features and fixes.

The app will open in a command window, and will then open in a web browser. Keep the command window open and minimized and use the browser to interface with SillyTavern.

NOTE: It’s possible to change the web address (default 127.0.0.1:8000), to make SillyTavern available remotely, to set whitelists and passwords, and to prevent opening the web browser on load. This is all done in the file config.yaml which you can open in Notepad or any text editor. SillyTavern’s online documentation explains how to set up different options in config.yaml.

To uninstall: simply close the command window and delete the folder on your computer.

Connecting to RealmPlay

Configuring SillyTavern for the RealmPlay API is simple. Click the API Connection icon at the top of the window:

Choose the following options:

  • API: Chat Completion

  • Chat Completion Source: Custom (OpenAI-compatible)

  • Custom Endpoint (base URL): https://model.realmplay.ai/v1

  • Custom API Key: Your API key from RealmPlay (https://www.realmplay.ai/user - scroll to the bottom)

  • Enter a Model ID: realmplay-405b (note: this must be exact, doublecheck your spelling!)

Once this is set, you can click Connect to test the connection.

SillyTavern Configuration

It’s important to configure SillyTavern to match your API.

NOTE: Chat Completion models like RealmPlay do not use Advanced Formatting. That section of the settings can be ignored.

Response Configuration

Click the AI Response Configuration to choose your settings.

Important settings are as follows:

  • Context Size (tokens): 128000

  • Max Response Length (tokens): user preference, this will determine the length of the AI responses. 300-500 is a good starting point.

  • Continue prefill: Checked (This prevents the AI repeating the previous message when asked to “continue” a message that was too short)

  • Squash system messages: Checked

User Settings

  • Auto-fix Markdown: Unchecked (user preference, but this avoids formatting issues when “continuing” a message)

Getting Cards

There are several websites where users create and share character cards. As of this writing, the most popular is “Character Hub”. It has two front-end websites with different interfaces. characterhub.org is better for searching and browsing cards, while chub.ai has better support for its community features, but both connect to the same database of cards. You will generally want to download the V2 PNG versions of your cards. To import a character into SillyTavern, simply drag and drop the downloaded PNG or JSON file onto the web browser.

Cleaning up cards

System prompts

Many card creators include out-of-character (OOC) system prompts. For example:

While the creator means well, and while this was necessary in the past, too often it causes problems. In the case of the card this image was lifted from, there were more instructions than description, which caused the AI to “forget” nearly every detail of the character during play. What was meant to be a clumsy, near-feral goblin with only a broken command of English turned into a graceful, well-spoken character who exhibited none of the desired traits. Completely removing all OOC instructions from the card caused it to return to something closer to the intended behavior.

But the AI keeps speaking for the user!

The solution to this issue is better writing. OOC prompting is a band-aid fix. What the card author needs to do is ensure that the card’s sample dialogue and opening messages NEVER narrate anything the user’s character does.

Bad: “You hear a rustling in a nearby bush. Brandishing a knife, you approach and discover a female goblin.”

Good: “You hear a rustling in a nearby bush. Unbeknownst to you, {{char}}, a female goblin, is hiding within the leaves, observing you.”

Pay close attention to things like verb tense (past, present) and perspective (1st, 2nd, 3rd person). Remember that the first message sets the writing style for most of the chat. Keep it consistent.

Tips for Play

Reminding the AI

Sometimes, the AI can forget what it’s supposed to be doing. This is especially problematic when the AI is meant to be lying to or manipulating the player character. Due to the short-term nature of AI memory, it can easily base its responses on what it’s said and “forget” that it didn’t “mean” those things. There are a few ways to keep it on task.

Objectives Plugin

The Objectives plugin lets you set or generate goals for your AI partner to strive toward. For example, in the story of Leo (AI) and Jane (player), Leo is trying to manipulate Jane into trusting him. The below image shows some of the goals that the system generated for Leo to follow.

After each message, the AI will check against the goals and check them off if they have been achieved.

OOC Reminders

In this example, Leo is talking to Jane. Jane’s player has noticed that Leo’s internal monologue has become that of a good person instead of a manipulator, and while this is desirable in real life, it’s not the story that Jane’s player wants to tell (highlighting has been added to some relevant sections). So, they inject a reminder into a message:

Regular injections of OOC, either on their own or as part of a larger post by the player, can help remind the AI of its role. If a particular OOC injection becomes needed often, it can be added to the Author’s Note in SillyTavern, which will automatically inject it at regular intervals. In future, we aim to be able to weight the character’s personality and description higher to help curb this requirement.

Response formatting

Many cards are formatted in a style based on old text-based RP on IRC, where players would frequently use asterisks to denote actions, sometimes using quotes around speech and other times omitting it entirely:

*He tips his hat* Good day to you.

Unfortunately, this format introduces an arbitrary form of punctuation; if the training data the model was created from originated in prose such as books and short stories, the AI may get confused. A more descriptive prose-style format tends to play better into the training data and be less prone to formatting mistakes:

“Good day to you,” he says, tipping his hat.

Try not to over-use “-ly” words (adjectives such as “quickly” or “respectfully”) as they have been known to send a model into a loop of garbage text and can make the text too formulaic. Remember that the AI is looking for patterns to copy, so if every response contains the same sort of sentence structure it becomes easier to get stuck with repeating phrases.

“Hello,” she said meekly

can be better written as

“Hello,” she said, her voice a meek whisper.

In the above example we’ve used the adverb “meek” and added the verb “whisper” which gives more detail as well as varying up the sentence structure.

Support and Social Media

Note: Discord is the preferred contact for support and assistance.

RealmPlay Discord: https://discord.gg/HDFu93rZ5W

RealmPlay Subreddit: https://www.reddit.com/r/realmplay

RealmPlay Twitter/X: https://twitter.com/Realmplayai

Email: support@realmplay.ai

Last updated