Get users name with structured outputs
Demo: https://vit.xwm.mybluehost.me/samples-site/?name-getter
Let's use structured outputs to get the users name. For validation that what was provided was actually a name we just use the llm's judgement.
Generated the system message this time which is why it's so verbose. The more instructions in the system prompt, the more likely any one line is to be ignored. But this is such a simple case, we don't have any more instructions to add, so we can let it be extremely thorough.
And....it works
The point of this is for use with a chatbot in a virtual classroom. The teacher simply needs to know which student is interacting with the chatbot. If any info provided by the chatbot is not 100% accurate, the teacher will know which student to contact and provide clarification.
Additional Points:
1. This Json schema is actually wrong. You can’t tell the system prompt to leave a value null unless null is one of the types specified for that property. You can tell it to leave it empty.
Otherwise, you need to define the type like this:
"type": ["string", "null"],
2. The generated system prompts are even worse that I realized at the time of writing this. The examples that the generated system prompts provide will often cause the entire output to be incorrect because it draws information from the examples in the system prompt instead of from the user input.
3. This would be the first step in many other functions such as, creating meta-data on this user , creating a user profile, using their name in a database entry, sending the user a personalized SMS/email, and allowing users to resume previous chats.




