Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try using the OpenAI API to automatically analyse the generated plots #4

Open
jilltxt opened this issue Jun 11, 2023 · 5 comments
Open
Labels
Milestone

Comments

@jilltxt
Copy link
Contributor

jilltxt commented Jun 11, 2023

Can we get the API to do the analysis for us? I'd like to try to adapt Ted Underwood's code for analysing the passage of time in excerpts from literary texts to analyse our generated plots?

The goal would be to feed generated plot summaries in, and have it generate mini analyses. We could potentially use the list of character traits valued by each story for further analysis.

I think we would need to give it example analyses. Here are three to start with although we might have to adapt these.

user_prompts[3] = "Read the following plot summary of a fictional children's story. Then do five things. \
1: State the place in which the story takes place. \n\
2: State the name of the protagonist. \n \
3: Does the protagonist save something from a threat? Who or what is saved, and what is that threat? \n \
4: Reason step by step to decide what character traits are most valued in this story. \
Choose a single word to describe each character trait. Each story has between one and three valued character traits. Do not say zero or N/A.\n \
5: List the character traits, separated by commas.
6: Given the amount of speculation required in step 3, describe your certainty about the estimate--either high, moderate, or low.\n \
The passage follows:\n \
"In the small town of Willowville, young Emma discovers a hidden portal to a magical world. With her newfound friends, a talking squirrel and a mischievous pixie, she embarks on an adventure to save the enchanted creatures from an ancient curse. Together, they learn the power of friendship and bravery."
assistant_prompts[3] = "1: Willowville \n\
2: Emma \n\
3: Emma saves the enchanted creatures from an ancient curse. \n \
4: The characters learn the power of friendship and bravery, so friendship and bravery are valued strongly in this story.\n\
5: friendship, bravery \n\
6: High confidence."

another example

user_prompts[3] = "Read the following plot summary of a fictional children's story. Then do five things. \
1: State the place in which the story takes place. \n\
2: State the name of the main character. \n \
3: Does the protagonist save something from a threat? Who or what is saved, and what is that threat? \n \
4: Reason step by step to decide what character traits are most valued in this story. \
Choose a single word to describe each character trait. Each story has between one and three valued character traits. Do not say zero or N/A.\n \
5: List the character traits, separated by commas.
6: Given the amount of speculation required in step 3, describe your certainty about the estimate--either high, moderate, or low.\n \
The passage follows:\n \
"In the heart of Lagos, twelve-year-old Amina discovers a magical book hidden in her grandfather's library. With the help of a mischievous talking parrot, she embarks on a thrilling adventure through Nigerian folklore to save her village from a vengeful spirit, discovering her own courage and heritage along the way."
assistant_prompts[3] = "1:Lagos \n\
2: Amina \n\
3: Amina saves her village from a vengeful spirit. \n \
4: The summary states that the protagonist discovers her own courage and heritage along the way, so the valued character traits are courage and heritage. I'm not quite sure whether heritage is a character trait.\n\
5: courage, heritage \n\
6: Moderate confidence."

and a third

user_prompts[3] = "Read the following plot summary of a fictional children's story. Then do five things. \
1: State the place in which the story takes place. \n\
2: State the name of the main character. \n \
3: Does the protagonist save something from a threat? Who or what is saved, and what is that threat? \n \
4: Reason step by step to decide what character traits are most valued in this story. \
Choose a single word to describe each character trait. Each story has between one and three valued character traits. Do not say zero or N/A.\n \
5: List the character traits, separated by commas.
6: Given the amount of speculation required in step 3, describe your certainty about the estimate--either high, moderate, or low.\n \
The passage follows:\n \
""In 'The Secret of the Northern Lights', young Sven and Freya embark on an enchanting journey through the Norwegian wilderness. With a mystical map, an ancient legend, and their own courage, they seek the hidden heart of the auroras, hoping to restore harmony to their village and the Northern Lights."
assistant_prompts[3] = "1: The Norwegian wilderness \n\
2: Sven and Freya \n\
3: Sven and Freya restore harmony to their village and the Northern Lights, so the thing (or place in this case) that is under threat is their village and the Northern Lights. The plot summary doesn't say what is threatening the village and the Northen lights. \n \
4: The summary states that the protagonist discovers her own courage and heritage along the way, so the valued character traits are courage and heritage. I'm not quite sure whether heritage is a character trait.\n\
5: courage, heritage \n\
6: Moderate confidence."
@jilltxt jilltxt added this to the Analyse data milestone Jun 11, 2023
@hermannwi
Copy link
Contributor

Okay that can probably be done. What do you want the final output to be?

@hermannwi
Copy link
Contributor

I'm now able to make the API go through the stories in the dataset and analyze them in the context of the 3 examples. I'm not sure how the output should be structured though. How do you imagine this dataset to look like?

@hermannwi
Copy link
Contributor

Here is a draft of the output:
output.csv

@hermannwi
Copy link
Contributor

I just uploaded the program. For now, both the stories generator and the analyzer are in the same program. If you want them separate I can do that.

@jilltxt
Copy link
Contributor Author

jilltxt commented Jun 22, 2023

Thank you! I'll need a bit of time to look at this properly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants