@@ -48,6 +48,11 @@ public struct GenerationConfig: Sendable {
4848 /// Output schema of the generated candidate text.
4949 let responseSchema : Schema ?
5050
51+ /// Output schema of the generated response in [JSON Schema](https://json-schema.org/) format.
52+ ///
53+ /// If set, `responseSchema` must be omitted and `responseMIMEType` is required.
54+ let responseJSONSchema : JSONObject ?
55+
5156 /// Supported modalities of the response.
5257 let responseModalities : [ ResponseModality ] ?
5358
@@ -175,6 +180,26 @@ public struct GenerationConfig: Sendable {
175180 self . stopSequences = stopSequences
176181 self . responseMIMEType = responseMIMEType
177182 self . responseSchema = responseSchema
183+ responseJSONSchema = nil
184+ self . responseModalities = responseModalities
185+ self . thinkingConfig = thinkingConfig
186+ }
187+
188+ init ( temperature: Float ? = nil , topP: Float ? = nil , topK: Int ? = nil , candidateCount: Int ? = nil ,
189+ maxOutputTokens: Int ? = nil , presencePenalty: Float ? = nil , frequencyPenalty: Float ? = nil ,
190+ stopSequences: [ String ] ? = nil , responseMIMEType: String , responseJSONSchema: JSONObject ,
191+ responseModalities: [ ResponseModality ] ? = nil , thinkingConfig: ThinkingConfig ? = nil ) {
192+ self . temperature = temperature
193+ self . topP = topP
194+ self . topK = topK
195+ self . candidateCount = candidateCount
196+ self . maxOutputTokens = maxOutputTokens
197+ self . presencePenalty = presencePenalty
198+ self . frequencyPenalty = frequencyPenalty
199+ self . stopSequences = stopSequences
200+ self . responseMIMEType = responseMIMEType
201+ responseSchema = nil
202+ self . responseJSONSchema = responseJSONSchema
178203 self . responseModalities = responseModalities
179204 self . thinkingConfig = thinkingConfig
180205 }
@@ -195,6 +220,7 @@ extension GenerationConfig: Encodable {
195220 case stopSequences
196221 case responseMIMEType = " responseMimeType "
197222 case responseSchema
223+ case responseJSONSchema = " responseJsonSchema "
198224 case responseModalities
199225 case thinkingConfig
200226 }
0 commit comments