-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
Description
Description
Using the URL Context tool with the Gemini Developer API (Google AI) frequently results in HTTP 500 errors from the backend.
Reproducing the issue
The integration test intermittently fails:
firebase-ios-sdk/FirebaseAI/Tests/TestApp/Tests/Integration/GenerateContentIntegrationTests.swift
Lines 427 to 452 in 541ac34
@Test( | |
"generateContent with URL Context", | |
arguments: InstanceConfig.allConfigs | |
) | |
func generateContent_withURLContext_succeeds(_ config: InstanceConfig) async throws { | |
let model = FirebaseAI.componentInstance(config).generativeModel( | |
modelName: ModelNames.gemini2_5_Flash, | |
tools: [.urlContext()] | |
) | |
let prompt = """ | |
Write a one paragraph summary of this blog post: \ | |
https://developers.googleblog.com/en/introducing-gemma-3-270m/ | |
""" | |
let response = try await model.generateContent(prompt) | |
let candidate = try #require(response.candidates.first) | |
let urlContextMetadata = try #require(candidate.urlContextMetadata) | |
#expect(urlContextMetadata.urlMetadata.count == 1) | |
let urlMetadata = try #require(urlContextMetadata.urlMetadata.first) | |
let retrievedURL = try #require(urlMetadata.retrievedURL) | |
#expect( | |
retrievedURL == URL(string: "https://developers.googleblog.com/en/introducing-gemma-3-270m/") | |
) | |
#expect(urlMetadata.retrievalStatus == .success) | |
} |
Firebase SDK Version
12.4.0
Xcode Version
26.0
Installation Method
Swift Package Manager
Firebase Product(s)
AI Logic
Targeted Platforms
All
Relevant Log Output
If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved
snippet
Replace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand Podfile.lock
snippet
Replace this line with the contents of your Podfile.lock!