badgids / OpenKlyde

An AI Discord bot that connects to a koboldcpp instance by API calls. Have a more intelligent Clyde Bot of your own making!
GNU General Public License v3.0
25 stars 10 forks source link

How to set to Chat instead of Instruct? #4

Closed Mage-Enderman closed 1 year ago

Mage-Enderman commented 1 year ago

How do I change it to be in chat mode as opposed to Instruct? /model-parameters change doesn't work

badgids commented 1 year ago

/model-parameters is still a work in progress. It will eventually controll the LLM's generation settings found in the json files in the /configurations directory in the bot's root directory.

The behavior of the bot (besides the LLM model's default persona) is controlled by the get_character function in the functions.py file. It access the JSON elements for the bot charater's persona from the character's JSON file in the /characters directory.

functions.py: lines 227 - 224


# Get the current bot character in a prompt-friendly format
def get_character(character_card):

    # Your name is <name>.
    character = "Your name is " + character_card["name"] + ". "

    # Your name is <name>. You are a <persona>.
    character = character + "You are " + character_card["persona"] + ". "

    # Instructions on what the bot should do. This is where an instruction model will get its stuff.
    character = character + character_card["instructions"]

    # Example messages!
    character = character + "Here is how you speak: " + "\n" + '\n'.join(character_card['examples']) +"\n"

    return character

The default bot "Kobold"'s settings are found in the default.json file in the /characters directory. To change Kobold's behavior you'll want to edit the "persona" and ""instructions" fields in the json file, you can also give it some example conversations to cater it's reply even more in the "examples" field.

You can create a new charater too. Simply create a new json file with the same layout and place it in the /characters diectory. i.e.:

Empty_Character.json

{
  "name": "Bot Name",
  "persona": "Place bot persona here",
  "examples": ["Place example conversations here", "You can have multiple examples.", "Seperate examples by commas and place in quotes" ],
  "instructions": "Place the inmstructions for you bot here example: "Reply in great detail. You are long winded, and like to talk.",
  "image": "Place/the/path/to/your/bots/avatar/image/here/Empty_Character.png"
}

Then you can save the blank template and just copy it to a new file and fill in the details as you see fit. You can explore the other character files in the character directory to get a feel of how the character json files are put together.

To change the bots persona, in Discord chat type /personality set. To view the bot's personality /personality view and to reset the bot's personality to whatever is in default.json you type /personality reset

Hope this helps you out, Cheers! 🍻