Show HN: Prompt Engineering to extract data from a story and into a database
CREATE DATABASE character_world; USE character_world; CREATE TABLE Personalities(char_name, values, interests, strengths, descr); CREATE TABLE Preferences(char_name, likes, dislikes, activities, topics, descr);CREATE TABLE Conversations(char_name, topics, length, tone, people, descr);CREATE TABLE Environment(char_name, weather, time_of_day, location, descr);CREATE TABLE Events(char_name, type, date, people, descr);CREATE TABLE Locations(char_name, type, size, amenities, descr);CREATE TABLE Actions(char_name, type, target, result, descr);CREATE TABLE Reactions(char_name, type, intensity, duration, descr); CREATE TABLE Context(char_name, bg_noise, lighting, temp, descr);CREATE TABLE Relationships(char_name, type, duration, strength, descr);CREATE TABLE Memories(char_name, date, people, emotions, clarity, vividness, accuracy, descr);CREATE TABLE Goals(char_name, importance, timeline, progress, difficulty, rewards, risks, descr);CREATE TABLE Beliefs(char_name, intensity, source, evidence, certainty, relevance, implications, descr);CREATE TABLE Moods(char_name, mood, intensity, timestamp, cause, descr);CREATE TABLE Character_Traits(char_name, phys_traits, pers_traits, skills, descr);CREATE TABLE Scene_Details(char_name, setting, objects, people, descr);CREATE TABLE Dialogue(char_name, speaker, words, tone, descr);CREATE TABLE Emotions(char_name, emotion, intensity, duration, descr);CREATE TABLE Thoughts(char_name, thought, clarity, relevance, descr);

Extract character information from the story which can be stored in this database and write the output as a mysql query.

------------------------End Prompt--------

Take some text and place it above this prompt (I use text-davinci-003 with temp 0)

Example from The Gift of the Magi

INSERT INTO Personalities (char_name, values, interests, strengths, descr) VALUES ('Della', 'generosity, love', 'buying gifts for Jim', 'resourcefulness, determination', 'The protagonist of the story');

INSERT INTO Preferences (char_name, likes, dislikes, activities, topics, descr) VALUES ('Della', 'Jim, her hair, giving gifts', 'parsimony, not having enough money', 'shopping, styling her hair', 'Christmas, presents', 'Della''s preferences');

INSERT INTO Conversations (char_name, topics, length, tone, people, descr) VALUES ('Della', 'Christmas, presents, Jim', 'short', 'excited, anxious', 'Jim', 'Della''s conversations with Jim');

INSERT INTO Environment (char_name, weather, time_of_day, location, descr) VALUES ('Della', 'cold', 'evening', 'furnished flat', 'Della''s environment');

INSERT INTO Events (char_name, type, date, people, descr) VALUES ('Della', 'Christmas', 'December 25th', 'Della and Jim', 'Della''s Christmas event');

INSERT INTO Locations (char_name, type, size, amenities, descr) VALUES ('Della', 'flat', 'small', 'letter-box, electric button', 'Della''s flat');

INSERT INTO Actions (char_name, type, target, result, descr) VALUES ('Della', 'buying', 'gift for Jim', 'success', 'Della''s action of buying a gift for Jim');

INSERT INTO Reactions (char_name, type, intensity, duration, descr) VALUES ('Della', 'crying', 'strong', 'short', 'Della''s reaction to not having enough money');

I just started playing with this earlier today and all I can say is just grab some arbitrary text and try it out :)

*some formatting edits
*formatting is still bad and I feel bad about leaving it..