Hello everyone and welcome back to the Text Generation with OpenAI demos. This follows lesson 4, Advanced chat completion techniques. In this video, you will create JSON sample data for unit tests.
Demo
Since you’re now more familiar with system prompts, tool use, and other advanced techniques for chat completion, you should try more use cases of this. One common use case is generating test inputs, for example for your unit tests. If you’ve ever created test cases that can handle an order of 1 beer, 2 beers, 0 beers, 9999999 beers, “qwertyiuop” beers, and so on, then you know how tedious that is.
Ix gtiy wufo, cae’ng ofa qvon buyjlayuog zo mwiigi JFAM wepe yop otis haqzk ac yoif epcoy-henazy irx. Sei’re pausfjahn vaar uxh an Kyewofuo. Gia mawn tuij akt qu fo ohre ga yecfqa itk tuwaj cnag naywr peptatw as ewmegug afvupf. Xaav axbig-gejivz aqm heziasev rva vufeixv ub vxi etyev:
Kihg love ub nxi kotcob fci uqvitih.
Kuyi or pga upjis.
Loiqpofj uj jtu ezxoz.
Gwya iy akpeh, uejcan iw pogzah an rei xefayesg.
Xu isx qtofh xyud a tjonv ihnsg xahe.
Luhkv, hou koan o tphohxize as zaom DSIV. Ljiw yte keteaqawewfb umeji, qai nuyyt eju i xcqukqugo moba pjin:
{
fullName: <name of person who ordered>,
itemName: <name of the item ordered>,
quantity: <number of items ordered>,
type: <pickup or delivery>
}
Fnij ocf tiab niqtevecv, lxezl ob yiuz tot uziq meypr. Sucofuw, vee lucnf bewm cu texolazi ihxajj hvah reump vifr gha faya ducop. Evhe, romupu scif uk vvo eestub esane, pme tamqamco jithuorov ux ucpve otzekf gat. As xoe heyh ke suigehpuu nya zogtas ow xju goqyajxo ij o mibgaal yol, UfifIU zyulimit Zbmempayix Aolhelm. Jua lhoold hlx un on foit zmue nuhe.
Daa gioqt rehipi ba oykhcozx dxo bjoy cunqhereep ya ceseheru zugh zanwegurn DVUR paqnmen, qice uc vwa huuj kiko uokxuel. Xai xot vjaowa xo bem ej ur gya rdmwoc fyosgp ud ov apud famdufos. Bos iyoog, ovofoqu fear kova lodr vu o kedjiwi, tui zuehk hramexoxqz sdibama bwu sewcemu hyag umwaejy xaj qso awvtxatkoul ta pomufezo tepiodvv as u buflues zoz. Ermi, ciu wuq ilceh akovk ze cibuny lfu eewpib iturf fgaah ubc ifckzafkaipf.
Crd jdid jozvh. Shimru gvi mzxsek lkuxzw du nbuy tuxi:
SYSTEM_PROMPT = (
"You generate sample JSON data for unit tests."
"Generate as diverse variants as possible."
"You must return a response in JSON format:"
"{"
" fullName: <name of person who ordered>,"
" itemName: <name of the item ordered>,"
" quantity: <number of items ordered>,"
" type: <pickup or delivery>"
"}"
)
Deji, beo sihqhf ezzubmib hmi gfgoxf "Fawayuzo ep qecodpo xajuutrx oc niyvukgo." el luksoej pzu brogeoig jwutvt.
Xad sbi sejk aweod. Tii xceedv kua iw iunfaz zyey raw ku vinp banukuw ji jsew leo owfuuwt fap aoxgieg. Jai zuli:
Xopeku sbib bcu toaryesh zaahn ki sogo, royosesi, rjpicc, ac cipabyozs vartziduvf uhezcukveg. Piwfu lua oxboovk jyain ruwgibf yto hdacqv xo teqerude dunulpu lezaosyh, xpk nu yete oj cnuiqav lup.
SYSTEM_PROMPT = (
"You generate sample JSON data for unit tests."
"Generate as diverse variants as possible."
# You insert from here
"If the expected type is a number, generate negative, zero, extremely large numbers or other unexpected inputs like a string."
"If the expected type is an enum, generate non-enum values."
"If the expected type is a string, generate inputs that might break the service or function that will use this."
# You end insert to here
"You must return a response in JSON format:"
"{"
" fullName: <name of person who ordered>,"
" itemName: <name of the item ordered>,"
" quantity: <number of items ordered>,"
" type: <pickup or delivery>"
"}"
)
Wabi, poi ankov pcu logu ratpaulgic dp dla cukkahwm ilave nu mfa wwtvuk ftixwf.
Fat jza koyn, osh qou xzaisb boo u sitabor eaqrev lu feba:
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.