Chapter 6 of 10

GPT-5.x Deep Dive

Model-specific techniques for OpenAI GPT models including function calling, JSON mode, and system instructions.

12 min readFree

GPT-5 Architecture and Strengths

OpenAI GPT-5 builds on the transformer architecture with improvements in reasoning, instruction following, and tool use. It is the most widely adopted model family with the largest ecosystem of integrations, plugins, and community resources.

GPT-5 excels at code generation across many languages, creative writing with nuanced tone control, function calling and structured API interactions, broad general knowledge and current events awareness, and rapid prototyping where speed matters more than perfect precision.

The model comes in several variants optimized for different use cases: the standard model for general tasks, a mini variant for fast and cheap processing, and specialized versions for reasoning-heavy tasks.

Function Calling and Tool Use

Function calling is GPT's standout feature for production applications. You define functions (tools) with their parameters, and the model decides when to call them and what arguments to pass.

This is fundamentally different from asking the model to output JSON that you parse. With function calling, the model understands the semantic meaning of each function and can chain multiple calls together to accomplish complex tasks.

Real-world applications include: querying databases based on natural language questions, calling external APIs to fetch live data, performing calculations with verified precision, and orchestrating multi-step workflows where each step requires different tools.

Function Calling ExampleGPT-5

Prompt:

System: You are a helpful assistant with access to a weather API and a calendar API. Functions available: - get_weather(city: string, date: string) -> {temp, conditions} - create_event(title: string, date: string, time: string) -> {event_id} User: "Schedule an outdoor team lunch next Friday, but only if the weather in Austin will be above 70°F."

Output:

The model first calls get_weather("Austin", "next Friday") to check conditions, evaluates the temperature against the 70°F threshold, then conditionally calls create_event("Team Lunch", date, "12:00 PM") only if the weather qualifies. It reports the result naturally to the user.

JSON Mode and Structured Outputs

GPT-5 has a native JSON mode that guarantees the output is valid JSON. This eliminates the need to parse free-text responses and catch formatting errors.

To use JSON mode effectively, describe your desired JSON schema in the system prompt. Be explicit about field names, data types, and whether fields are required or optional. The more precise your schema description, the more consistent the output.

For even stricter control, structured outputs let you define an exact JSON schema that the model must follow. This is invaluable for production pipelines where downstream systems expect a specific data format.

GPT-Specific Prompting Tips

GPT responds well to explicit formatting instructions. If you want a numbered list, say "respond with a numbered list." If you want paragraphs, say "write in paragraph form, no bullet points."

Use the system message for persistent behavior and the user message for the specific task. Keep system messages under 500 words — longer system messages can dilute the instructions.

GPT handles creative writing tasks particularly well. For fiction, marketing copy, or conversational content, GPT often produces more natural, flowing prose than other models. Lean into this strength for content generation tasks.

For code generation, specify the language, framework version, and coding style upfront. GPT is trained on massive amounts of code and can generate production-ready snippets when given sufficient context about your project setup.

Key Takeaways

  • GPT-5 is the strongest generalist with the largest tool ecosystem
  • Function calling enables reliable tool use and multi-step workflows
  • JSON mode guarantees valid JSON output — essential for production pipelines
  • Use system messages for persistent behavior, user messages for specific tasks
  • GPT excels at creative writing and code generation across many languages

Try It Yourself

If you have access to the OpenAI API, try defining a simple function and watch how GPT decides when to call it based on different user messages.

Open JSON Formatter