Improve structured data content for rookies (#7137)

Improve the content in `src/data/roadmaps/prompt-engineering/content/103-real-world/100-structured-data.md` to be more concise and understandable for rookies.
pull/7145/head
Saumya Shah 1 month ago committed by GitHub
parent fa0452e9c9
commit 387d5218b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 33
      src/data/roadmaps/prompt-engineering/content/103-real-world/100-structured-data.md

@ -1,15 +1,19 @@
# Structured Data
Asking the model to generate structured data is a great way to utilize the power of LLMs.
Structured data helps in organizing information. It is especially useful in applications like e-commerce where you need to convert user input into a structured format.
For example, you might have an e-commerce application where you want to generate the search query from the user's natural language input. You can instruct LLM to identify the JSON version from the natural language text given by the user. Let's say that the user searches for `Birthday gift for my 18 months old daughter`. We could have the following prompt to generate the JSON object:
### Example 1
Let's say a user searches for `Birthday gift for my 18 months old daughter`. You can use a prompt to generate a JSON object from this input:
```
Print a JSON object containing `gender` ("male", "female"), `occasion` (one of "party", "birthday", "anniversary"), `age_years` (numeric value) from the text delimited by tripple quotes.:
Print a JSON object containing `gender` ("male", "female"), `occasion` (one of "party", "birthday", "anniversary"), `age_years` (numeric value) from the text delimited by triple quotes:
"""Birthday gift for my 18 months old daughter"""
```
The output from model would be:
### Output
The model would generate the following JSON object:
```json
{
@ -18,3 +22,24 @@ The output from model would be:
"age_years": 1.5
}
```
### Example 2
Consider a user input `Anniversary gift for my husband`. You can use a prompt to generate a JSON object from this input:
```
Print a JSON object containing `gender` ("male", "female"), `occasion` (one of "party", "birthday", "anniversary"), `age_years` (numeric value) from the text delimited by triple quotes:
"""Anniversary gift for my husband"""
```
### Output
The model would generate the following JSON object:
```json
{
"gender": "male",
"occasion": "anniversary",
"age_years": null
}
```

Loading…
Cancel
Save