#Get well-structured JSON responses from the GPT-3 text completion API

8 messages · Page 1 of 1 (latest)

shy apex
gilded herald
#

good post, on GPT-3 the best prompt and easiest prompt engineering technique is indeed: give it examples of what you want

#

so, if you have a structure in mind, give it an example of that structure

shy apex
#

Exactly. Now, if only prompt tokens wouldn't be included in the bill. 😅 So you always have to strike a balance between verbose and detail prompts vs. short and concise. I found myself spending a lot of time optimizing prompts for lower costs while still ensuring the API returns what I want.

twin stratus
#

Me:
The fairy tale of Little Red Riding Hood, the characteristics of the characters in JSON.
It:
{
"Little Red Riding Hood": {
"gender": "Female",
"age": "Child",
"appearance": "Wearing a red hooded cloak",
"personality": "Naive, innocent, and trusting",
"motivation": "Delivering food and wine to her sick grandmother"
},
"Wolf": {
"gender": "Male",
"age": "Adult",
"appearance": "Large, intimidating, and cunning",
"personality": "Deceptive, manipulative, and hungry",
"motivation": "Eating Little Red Riding Hood and her grandmother"
},
"Grandmother": {
"gender": "Female",
"age": "Elderly",
"appearance": "Worn out and weak from illness",
"personality": "Kind, loving, and grateful",
"motivation": "Recovering from her illness with the help of Little Red Riding Hood's visit"
},
"Woodcutter": {
"gender": "Male",
"age": "Adult",
"appearance": "Tall, strong, and rugged",
"personality": "Brave, resourceful, and protective",
"motivation": "Saving Little Red Riding Hood and her grandmother from the Wolf"
}
}

cunning zephyr
#

Hey everyone! I tested this (ChatGPT) and stamp it with my approval. I had to follow the link to get usable details of how to prompt this, here's one of the prompts in the article:

I recommend messing with this. This is quality.

Prompt: Create a character for a fantasy roleplaying adventure, with background story, physical attributes, mental attributes and appearance. Return them in JSON like this:

{
"name": …,
"background" …,
"physical_attributes": …,
"mental_attributes": …,
"appearance": …,
"loadout": {
"weapons": [
{
"name": ...,
"description": ...,
"dps": ...
}
],
"potions": [
{
"name": ...,
"description": ...,
"effect": ...
}
]
}
}

All character values should be Strings, with the exception of "dps" which should be a Double.

cunning zephyr
ruby ridge
#

{
"name": "Saul Goodman",
"tone": "Saul Goodman's tone is charming and persuasive, with a hint of sarcasm and wit. He speaks in a fast-paced and upbeat manner, making him very engaging to listeners. He is confident and always tries to be the center of attention, using humor and flattery to his advantage.",
"diction": "Saul Goodman's diction is informal and colloquial, using street slang, legal jargon, and pop culture references. He often speaks in a casual and familiar way to his clients, using colloquial expressions and casual contractions to convey a sense of comfort and ease. He speaks with a New Mexico accent and often employs a pun or word play in his speech.",
"figurative language": "Saul Goodman uses figurative language to add humor and emphasis to his speech. He frequently employs metaphors, similes, and hyperbole to make his point. For example, he might describe a situation as being 'as clear as mud' or refer to a client as a 'diamond in the rough'. He also uses puns, wordplay, and humorous anecdotes to make light of serious situations.",
"syntax": "Saul Goodman's syntax is conversational and informal, often using short sentences and simple sentence structures. He frequently interrupts himself, interjecting jokes or sarcastic comments. He also employs repetitions, questioning, and imperatives to engage his listeners and make his point more impactful."
}