@@ -233,7 +233,6 @@ struct GenerateContentIntegrationTests {
233
233
234
234
@Test (
235
235
arguments: [
236
- ( . vertexAI_v1beta_global, ModelNames . gemini2_5_Flash, ThinkingConfig ( thinkingBudget: 0 ) ) ,
237
236
( . vertexAI_v1beta_global, ModelNames . gemini2_5_Flash, ThinkingConfig ( thinkingBudget: - 1 ) ) ,
238
237
( . vertexAI_v1beta_global, ModelNames . gemini2_5_Flash, ThinkingConfig (
239
238
thinkingBudget: - 1 , includeThoughts: true
@@ -242,13 +241,11 @@ struct GenerateContentIntegrationTests {
242
241
( . vertexAI_v1beta_global, ModelNames . gemini2_5_Pro, ThinkingConfig (
243
242
thinkingBudget: - 1 , includeThoughts: true
244
243
) ) ,
245
- ( . googleAI_v1beta, ModelNames . gemini2_5_Flash, ThinkingConfig ( thinkingBudget: 0 ) ) ,
246
244
( . googleAI_v1beta, ModelNames . gemini2_5_Flash, ThinkingConfig ( thinkingBudget: - 1 ) ) ,
247
245
( . googleAI_v1beta, ModelNames . gemini2_5_Flash, ThinkingConfig (
248
246
thinkingBudget: - 1 , includeThoughts: true
249
247
) ) ,
250
248
( . googleAI_v1beta, ModelNames . gemini2_5_Pro, ThinkingConfig ( thinkingBudget: - 1 ) ) ,
251
- ( . googleAI_v1beta, ModelNames . gemini2_5_Pro, ThinkingConfig ( thinkingBudget: - 1 ) ) ,
252
249
( . googleAI_v1beta, ModelNames . gemini2_5_Pro, ThinkingConfig (
253
250
thinkingBudget: - 1 , includeThoughts: true
254
251
) ) ,
@@ -257,7 +254,7 @@ struct GenerateContentIntegrationTests {
257
254
func generateContentThinkingFunctionCalling( _ config: InstanceConfig , modelName: String ,
258
255
thinkingConfig: ThinkingConfig ) async throws {
259
256
let currentLocationDeclaration = FunctionDeclaration (
260
- name: " currentLocation " ,
257
+ name: " getCurrentLocation " ,
261
258
description: " Returns the user's current city, province or state, and country " ,
262
259
parameters: [ : ]
263
260
)
@@ -279,18 +276,23 @@ struct GenerateContentIntegrationTests {
279
276
thinkingConfig: thinkingConfig
280
277
) ,
281
278
safetySettings: safetySettings,
282
- tools: [ . functionDeclarations( [ currentLocationDeclaration, getTemperatureDeclaration] ) ]
279
+ tools: [ . functionDeclarations( [ currentLocationDeclaration, getTemperatureDeclaration] ) ] ,
280
+ systemInstruction: ModelContent ( parts: """
281
+ You are a weather bot that specializes in reporting outdoor temperatures in Celsius.
282
+
283
+ If not specified, assume that the user is asking for the temperature in their current \
284
+ location. Use the `getCurrentLocation` function to determine the user's location. Always use the \
285
+ `getTemperature` function to determine the current outdoor temperature in a location. You \
286
+ can use the output of the `getCurrentLocation` function as input to the `getTemperature` \
287
+ function to get the temperature in the user's location.
288
+
289
+ Always respond in the format:
290
+ - Location: City, Province/State, Country
291
+ - Temperature: #C
292
+ """ )
283
293
)
284
294
let chat = model. startChat ( )
285
- let prompt = """
286
- What is the temperature outside right now? Respond in the format:
287
- - Location: City, Province/State, Country
288
- - Temperature: #C
289
-
290
- Example Output:
291
- - Location: Vancouver, British Columbia, Canada
292
- - Temperature: 15C
293
- """
295
+ let prompt = " What is the current temperature? "
294
296
295
297
let response = try await chat. sendMessage ( prompt)
296
298
@@ -340,10 +342,8 @@ struct GenerateContentIntegrationTests {
340
342
341
343
#expect( response3. functionCalls. isEmpty)
342
344
let finalText = try #require( response3. text) . trimmingCharacters ( in: . whitespacesAndNewlines)
343
- #expect( finalText == """
344
- - Location: Waterloo, Ontario, Canada
345
- - Temperature: 25C
346
- """ )
345
+ #expect( finalText. contains ( " Waterloo " ) )
346
+ #expect( finalText. contains ( " 25 " ) )
347
347
348
348
if let _ = thinkingConfig. includeThoughts, case . googleAI = config. apiConfig. service {
349
349
#expect( thoughtSignatureCount > 0 )
0 commit comments