RunObjectResponseFormat class sealed
Specifies the format that the model must output. Compatible with
GPT-4o,
GPT-4 Turbo, and all GPT-3.5 Turbo models
since gpt-3.5-turbo-1106
.
Setting to { "type": "json_schema", "json_schema": {...} }
enables Structured Outputs which ensures
the model will match your supplied JSON schema. Learn more in the
Structured Outputs guide.
Setting to { "type": "json_object" }
enables JSON mode, which ensures the message the model generates
is valid JSON.
Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a
system or user message. Without this, the model may generate an unending stream of whitespace until the
generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note
that the message content may be partially cut off if finish_reason="length"
, which indicates the
generation exceeded max_tokens
or the conversation exceeded the max context length.
- Implementers
- Annotations
-
- @freezed
Constructors
-
RunObjectResponseFormat.fromJson(Map<
String, dynamic> json) -
Object construction from a JSON representation
factory
- RunObjectResponseFormat.mode(RunObjectResponseFormatMode value)
-
auto
is the default valueconstfactory - RunObjectResponseFormat.responseFormat(ResponseFormat value)
-
No Description
constfactory
Properties
Methods
-
map<
TResult extends Object?> ({required TResult mode(RunObjectResponseFormatEnumeration value), required TResult responseFormat(RunObjectResponseFormatResponseFormat value)}) → TResult -
inherited
-
mapOrNull<
TResult extends Object?> ({TResult? mode(RunObjectResponseFormatEnumeration value)?, TResult? responseFormat(RunObjectResponseFormatResponseFormat value)?}) → TResult? -
inherited
-
maybeMap<
TResult extends Object?> ({TResult mode(RunObjectResponseFormatEnumeration value)?, TResult responseFormat(RunObjectResponseFormatResponseFormat value)?, required TResult orElse()}) → TResult -
inherited
-
maybeWhen<
TResult extends Object?> ({TResult mode(RunObjectResponseFormatMode value)?, TResult responseFormat(ResponseFormat value)?, required TResult orElse()}) → TResult -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this RunObjectResponseFormat to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> ({required TResult mode(RunObjectResponseFormatMode value), required TResult responseFormat(ResponseFormat value)}) → TResult -
inherited
-
whenOrNull<
TResult extends Object?> ({TResult? mode(RunObjectResponseFormatMode value)?, TResult? responseFormat(ResponseFormat value)?}) → TResult? -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited