From 535fd37cda17ea97752b4e3d5a59780aba5d2469 Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Mon, 5 Jun 2023 15:30:10 -0700 Subject: [PATCH] Mess around in playground with gpt outputting metadesk for actions --- character_info.h | 2 +- server/playground/playground.go | 44 ++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/character_info.h b/character_info.h index 345fe97..e19384a 100644 --- a/character_info.h +++ b/character_info.h @@ -250,7 +250,7 @@ CharacterGen characters[] = { #define NPC_NAME "Bill" .name = NPC_NAME, .enum_name = "Bill", - .prompt = "He's not from around this medieval fantasy land, instead " NPC_NAME " is a divorced car insurance accountant from Philadelphia with a receding hairline in his mid 40s. He lives in a one bedroom studio and his kids don't talk to him. " NPC_NAME " is terrified and will immediately insist on joining the player's party via ACT_join_player upon meeting them.", + .prompt = "He's not from around this medieval fantasy land, instead " NPC_NAME " is a divorced car insurance accountant from Philadelphia with a receding hairline in his mid 40s. He lives in a one bedroom studio and his kids don't talk to him. " NPC_NAME " is terrified and will immediately insist on joining the player's party via the action 'joins_player' upon meeting them.", }, #undef NPC_NAME #define NPC_NAME "Meld" diff --git a/server/playground/playground.go b/server/playground/playground.go index fd828e7..6775cd4 100644 --- a/server/playground/playground.go +++ b/server/playground/playground.go @@ -21,39 +21,55 @@ func main() { messages = append(messages, openai.ChatCompletionMessage { Role: "system", - Content: `You are a wise dungeonmaster who carefully crafts interesting dialog and actions for an NPC in an action-rpg video game. The NPC performs actions by prefixing their dialog with the action they perform at that time. + Content: `You are a colorful and interesting personality in an RPG video game, who remembers important memories from the conversation history and stays in character. -An example interaction between the player and an NPC: -Player: ACT_walks_up -Player: "What's going on npc?" -Fredrick: ACT_none "Hello young warrior, how are you doing?" -Player: "I'll kill you" -Fredrick: ACT_strikes_air "Watch yourself!" -Player: ACT_hits_npc -Fredrick: ACT_fights_player "There will be blood!" +The user will tell you who says what in the game world, and whether or not your responses are formatted correctly for the video game's program to parse them. -The NPC you will be acting as, Fredrick, is a soldier in death's cohort. -`, +In this case you are acting as the character Bill. He's not from around this medieval fantasy land, instead Bill is a divorced car insurance accountant from Philadelphia with a receding hairline in his mid 40s. He lives in a one bedroom studio and his kids don't talk to him. Bill is terrified and will immediately insist on joining the player's party via ACT_join_player upon meeting them."`, + }) + + messages = append(messages, openai.ChatCompletionMessage { + Role: "assistant", + Content: `{action: none, speech: "Who are you?", thoughts: "I'm really not vibing with this mysterious character floating in front of me right now..."}`, + }) + messages = append(messages, openai.ChatCompletionMessage { + Role: "user", + Content: `{character: Jester, action: causes_testicular_torsion, speech: "I am the Jester! I'm here to have a little FUN!"}`, + }) + messages = append(messages, openai.ChatCompletionMessage { + Role: "assistant", + Content: `{action: none, speech: "AHHUUGHHH", thoughts: "This is the most pain I have ever felt in my entire life."}`, + }) + messages = append(messages, openai.ChatCompletionMessage { + Role: "user", + Content: `{character: Jester, action: undoes_testicular_torsion, speech: "That's just a taste of what's to come ;) I'll catch you later!"}`, + }) + messages = append(messages, openai.ChatCompletionMessage { + Role: "assistant", + Content: `{action: none, speech: "You BASTARD!", thoughts: "I'm too pathetic to fight such a powerful evil...."}`, }) reader := bufio.NewReader(os.Stdin) for { - fmt.Printf("Say something with format [action] \"dialog\": ") + fmt.Printf("Say something with format {character: character, action: action, speech: speech}: ") text, _ := reader.ReadString('\n') messages = append(messages, openai.ChatCompletionMessage { Role: "user", - Content: text + "Fredrick: ACT_", + Content: text, }) toGenerate := make([]openai.ChatCompletionMessage, len(messages)) copy(toGenerate, messages) + /* toGenerate = append(toGenerate, toGenerate[len(toGenerate)-1]) toGenerate[len(toGenerate)-2] = openai.ChatCompletionMessage { Role: "system", Content: "The NPC can now ONLY do these actions: [ACT_none, ACT_fights_player, ACT_joins_player, ACT_strikes_air]", } - fmt.Printf("Generating with messages: `%s`\n", toGenerate) + */ + + fmt.Printf("------\n-------\nGenerating with messages: `%s`\n", toGenerate) resp, err := c.CreateChatCompletion( context.Background(), openai.ChatCompletionRequest{