Skip to content

Commit 37d304e

Browse files
committed
Add responseMIMEType to GenerationConfig
1 parent fcc1084 commit 37d304e

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

Sources/GoogleAI/GenerationConfig.swift

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,26 @@ public struct GenerationConfig {
6363
/// The stop sequence will not be included as part of the response.
6464
public let stopSequences: [String]?
6565

66+
/// Output response MIME type of the generated candidate text.
67+
///
68+
/// Supported MIME types:
69+
/// - `text/plain`: Text output; the default behavior if unspecified.
70+
/// - `application/json`: JSON response in the candidates.
71+
public let responseMIMEType: String?
72+
6673
/// Creates a new `GenerationConfig` value.
6774
///
68-
/// - Parameter temperature: See ``temperature``
69-
/// - Parameter topP: See ``topP``
70-
/// - Parameter topK: See ``topK``
71-
/// - Parameter candidateCount: See ``candidateCount``
72-
/// - Parameter maxOutputTokens: See ``maxOutputTokens``
73-
/// - Parameter stopSequences: See ``stopSequences``
75+
/// - Parameters:
76+
/// - temperature: See ``temperature``.
77+
/// - topP: See ``topP``.
78+
/// - topK: See ``topK``.
79+
/// - candidateCount: See ``candidateCount``.
80+
/// - maxOutputTokens: See ``maxOutputTokens``.
81+
/// - stopSequences: See ``stopSequences``.
82+
/// - responseMIMEType: See ``responseMIMEType``.
7483
public init(temperature: Float? = nil, topP: Float? = nil, topK: Int? = nil,
7584
candidateCount: Int? = nil, maxOutputTokens: Int? = nil,
76-
stopSequences: [String]? = nil) {
85+
stopSequences: [String]? = nil, responseMIMEType: String? = nil) {
7786
// Explicit init because otherwise if we re-arrange the above variables it changes the API
7887
// surface.
7988
self.temperature = temperature
@@ -82,6 +91,7 @@ public struct GenerationConfig {
8291
self.candidateCount = candidateCount
8392
self.maxOutputTokens = maxOutputTokens
8493
self.stopSequences = stopSequences
94+
self.responseMIMEType = responseMIMEType
8595
}
8696
}
8797

0 commit comments

Comments
 (0)