Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel
Michael cbebe2026f
chore(providers): add openai gpt-4o-2024-11-20 to supported models (#2203)
9 months ago
..
cd48ec371b
chore(openai): improve support for structured outputs (#1656)
11 months ago
cbebe2026f
chore(providers): add openai gpt-4o-2024-11-20 to supported models (#2203)
9 months ago

README.md

You have to be logged in to leave a comment. Sign In

OpenAI Structured Output Example

This example demonstrates how to use OpenAI's new Structured Outputs feature with JSON schemas to ensure model outputs adhere to a specific structure.

Key Features

  • Utilizes the gpt-4o model supporting Structured Outputs
  • Implements a JSON schema for analyzing customer support queries
  • Demonstrates the response_format parameter with a json_schema

How it Works

  1. The prompt asks the model to analyze a customer support query.
  2. The response is structured according to a predefined JSON schema, including fields like query summary, category, sentiment, urgency, and suggested actions.

Running the Example

To run:

promptfoo eval

This executes tests defined in promptfooconfig.yaml, covering various customer support scenarios and validating the model's output.

Note

For more details, refer to the OpenAI announcement.

Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...