Today We Did
- We started building streamlit page that will interact with ai functions which we build in spaceship_game.py.
- We displayed scenario produced by AI
- We added text area where user can enter their survival strategy.
- We faced problem where the streamlit page would refresh the scenario even before user able to submit the entered survival strategy causing the scenario and survival strategy to have mismatch. We will go over the solution next week.
Homework
Homework this time is to experiment more with JSON Schema and how to force the AI to return multiple fields JSON.
- Inside “spaceship_game.py” add a new
- function, create_a_new_person()
- Inside the function ask AI to create a new person every you call the function, which will return a JSON in the following format
{
"name": "Gamas",
"phone": "626-476-3067",
"age": 49,
"gender": "male"
}
- If the age is between 13 and 19 then said “Gamas you are a teenager with phone number of 626-476-3067”. If not then just say “Gamas your phone number is 626-476-3067.
- Similar to JUDGE_SCHEMA, you need to create PERSON_SCHEMA and pass this to the AI.
- call the function from inside spaceship_game.py.