ResponseFormat class
An object specifying the format that the model must output.
Setting to { "type": "json_object" }
enables JSON mode, which guarantees
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.
- Annotations
-
- @freezed
Constructors
- ResponseFormat({required String text})
-
constfactory
-
ResponseFormat.fromJson(Map<
String, Object?> json) -
factory
Properties
-
copyWith
→ $ResponseFormatCopyWith<
ResponseFormat> -
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- text → String
-
Must be one of text or json_object.
Defaults to text
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited