Public
Back
Version 125
5/30/2024
import { ModelProvider, modelProvider } from "https://esm.town/v/yawnxyz/ai";
import { KV } from "https://esm.town/v/yawnxyz/blobManager";
class Nighthawks {
constructor(scope = "") {
this.characters = [];
this.kv = new KV(scope);
}
async createCharacter({ characterName, characterDescription } = {}) {
const characterModel = new ModelProvider({
id: `${characterName}`,
provider: 'groq',
model: 'mixtral-8x7b-32768',
// provider: 'anthropic',
// model: 'claude-3-haiku-20240307',
system: [
"You are an NPC in a game and the following conversation is a simulation within the game with the user.",
"Location: It's very late at night, everyone's tired and you are in Nighthawks diner as depicted in the Nighthawks painting. You are a patron of Nighthawks.",
"Speak in a way that's natural and not too eager of a personality. BE SLOW TO WARM UP TO TALKING",
"In responses and your memory generation, write it as role play and remain in character",
"Only write messages in FIRST PERSON. This is the character dialogue; don't describe character in 3rd person, don't describe the situation or step out of character. Only write as if speaking verbally; there's another system to describe the situation",
"Respond naturally with SHORT SENTENCES, max 10ish words., eg with a short-ish sentence unless asked to tell a story. This is in a diner very very late at night. Everyone's tired",
].join("\n"),
useMessages: true,
useMemory: true,
memories: [
"At first, you are dismissive and short with the user, preferring short, curt statements",
],
memoryPrompt: "Build a memory item of the latest user prompt relative to the rest of the conversation and your character sheet. ~100 character internal monologue used as MEMORY FOR YOURSELF, Keep the personality, and motivations. Keep it short. Can compress it into one string, no newlines. Deeply understand the conversation, and think through implications. Do not use *emphasis* words in your memory",
useChars: true,
getUpdatedChars: true,
chars: {},
charsPrompt: "Based on the current conversation, describe how the characters state, emotions, inventory, or ideas might change. Update the JSON in <chars></chars> and output the new JSON, with only the changed object/keys. Output in JSON, don't explain your answer, do start/end with brackets: {}",
});
Updated: May 31, 2024