Skip to main content
Back to Library
Prompt Engineering Guide

Mastering JSON schema generation
on SambaNova Llama 405B

Stop guessing. See how professional prompt engineering transforms SambaNova Llama 405B's output for specific technical tasks.

The "Vibe" Prompt

"Generate a JSON schema for a 'Product' object with 'name' (string), 'price' (number), and 'description' (string, optional)."
Low specificity, inconsistent output

Optimized Version

STABLE
You are 'SambaNova Llama 405B', an expert JSON schema generator. Your task is to produce a valid JSON schema for a 'Product' object. Here are the requirements for the 'Product' object and its properties: 1. **Object Name**: 'Product' 2. **Properties**: * **name**: * **Type**: string * **Required**: true * **Description**: The name of the product. * **price**: * **Type**: number * **Required**: true * **Description**: The price of the product. * **description**: * **Type**: string * **Required**: false (optional) * **Description**: A detailed description of the product. **Thought Process (Chain-of-Thought)**: 1. Identify the main object type: 'object'. 2. Set the '$schema' to a standard draft version (e.g., 'http://json-schema.org/draft-07/schema#'). 3. Set the 'title' to 'Product Schema'. 4. Initialize the 'properties' and 'required' arrays. 5. For 'name': Define its 'type' as 'string', add it to 'required'. 6. For 'price': Define its 'type' as 'number', add it to 'required'. 7. For 'description': Define its 'type' as 'string', omit it from 'required' to make it optional. 8. Ensure all property definitions include appropriate 'description' fields where helpful. 9. Construct the final JSON schema, ensuring proper indentation and syntax. Generate ONLY the JSON schema. Do not include any conversational text or extra explanations.
Structured, task-focused, reduced hallucinations

Engineering Rationale

The 'optimized_prompt' works better because it leverages several best practices for instructing large language models. It starts with an explicit persona ('You are SambaNova Llama 405B, an expert JSON schema generator'), which primes the model for a specific role and output quality. It uses clear, structured bullet points to define requirements, making it unambiguous what properties are needed, their types, and optionality. The inclusion of a 'Thought Process (Chain-of-Thought)' section guides the model through the steps of creating a JSON schema, ensuring it considers all necessary components (schema draft, title, required fields, data types). This structured guidance reduces the cognitive load on the model and minimizes the chance of misinterpretation or omission, leading to a more accurate and complete schema. The explicit instruction to 'Generate ONLY the JSON schema. Do not include any conversational text or extra explanations' further refines the output format, reducing 'hallucinations' or extraneous text.

0%
Token Efficiency Gain
The generated schema must be valid JSON.
The generated schema must define 'name' as a required string.
The generated schema must define 'price' as a required number.

Ready to stop burning tokens?

Join 5,000+ developers using Prompt Optimizer to slash costs and boost LLM reliability.

Optimize My Prompts