diff --git a/app/src/internal/FirebaseInterops.cs b/app/src/internal/FirebaseInterops.cs
index c880f18f..70c4527e 100755
--- a/app/src/internal/FirebaseInterops.cs
+++ b/app/src/internal/FirebaseInterops.cs
@@ -442,9 +442,9 @@ internal static async Task AddFirebaseTokensAsync(HttpRequestMessage request, Fi
}
// Adds the other Firebase tokens to the WebSocket, as available.
- internal static async Task AddFirebaseTokensAsync(ClientWebSocket socket, FirebaseApp firebaseApp, string authTokenPrefix = "Firebase")
+ internal static async Task AddFirebaseTokensAsync(ClientWebSocket socket, FirebaseApp firebaseApp, string authTokenPrefix = "Firebase", bool limitedUseAppCheckTokens = false)
{
- string appCheckToken = await GetAppCheckTokenAsync(firebaseApp);
+ string appCheckToken = await GetAppCheckTokenAsync(firebaseApp, limitedUseAppCheckTokens);
if (!string.IsNullOrEmpty(appCheckToken))
{
socket.Options.SetRequestHeader(appCheckHeader, appCheckToken);
diff --git a/firebaseai/src/FirebaseAI.cs b/firebaseai/src/FirebaseAI.cs
index 80a5579e..45080412 100644
--- a/firebaseai/src/FirebaseAI.cs
+++ b/firebaseai/src/FirebaseAI.cs
@@ -92,11 +92,13 @@ public override readonly string ToString()
private readonly FirebaseApp _firebaseApp;
private readonly Backend _backend;
+ private readonly bool _useLimitedUseAppCheckTokens;
- private FirebaseAI(FirebaseApp firebaseApp, Backend backend)
+ private FirebaseAI(FirebaseApp firebaseApp, Backend backend, bool useLimitedUseAppCheckTokens)
{
_firebaseApp = firebaseApp;
_backend = backend;
+ _useLimitedUseAppCheckTokens = useLimitedUseAppCheckTokens;
}
///
@@ -114,18 +116,22 @@ public static FirebaseAI DefaultInstance
/// Returns a `FirebaseAI` instance with the default `FirebaseApp` and the given Backend.
///
/// The backend AI service to use.
+ /// Whether to use limited use App Check tokens for
+ /// requests.
/// A configured instance of `FirebaseAI`.
- public static FirebaseAI GetInstance(Backend? backend = null)
+ public static FirebaseAI GetInstance(Backend? backend = null, bool useLimitedUseAppCheckTokens = false)
{
- return GetInstance(FirebaseApp.DefaultInstance, backend);
+ return GetInstance(FirebaseApp.DefaultInstance, backend, useLimitedUseAppCheckTokens);
}
///
/// Returns a `FirebaseAI` instance with the given `FirebaseApp` and Backend.
///
/// The custom `FirebaseApp` used for initialization.
/// The backend AI service to use.
+ /// Whether to use limited use App Check tokens for
+ /// requests.
/// A configured instance of `FirebaseAI`.
- public static FirebaseAI GetInstance(FirebaseApp app, Backend? backend = null)
+ public static FirebaseAI GetInstance(FirebaseApp app, Backend? backend = null, bool useLimitedUseAppCheckTokens = false)
{
if (app == null)
{
@@ -135,13 +141,13 @@ public static FirebaseAI GetInstance(FirebaseApp app, Backend? backend = null)
Backend resolvedBackend = backend ?? Backend.GoogleAI();
// FirebaseAI instances are keyed by a combination of the app name and backend.
- string key = $"{app.Name}::{resolvedBackend}";
+ string key = $"{app.Name}::{resolvedBackend}::{useLimitedUseAppCheckTokens}";
if (_instances.ContainsKey(key))
{
return _instances[key];
}
- return _instances.GetOrAdd(key, _ => new FirebaseAI(app, resolvedBackend));
+ return _instances.GetOrAdd(key, _ => new FirebaseAI(app, resolvedBackend, useLimitedUseAppCheckTokens));
}
///
@@ -173,7 +179,8 @@ public GenerativeModel GetGenerativeModel(
{
return new GenerativeModel(_firebaseApp, _backend, modelName,
generationConfig, safetySettings, tools,
- toolConfig, systemInstruction, requestOptions);
+ toolConfig, systemInstruction, requestOptions,
+ _useLimitedUseAppCheckTokens);
}
///
@@ -200,7 +207,8 @@ public LiveGenerativeModel GetLiveModel(
{
return new LiveGenerativeModel(_firebaseApp, _backend, modelName,
liveGenerationConfig, tools,
- systemInstruction, requestOptions);
+ systemInstruction, requestOptions,
+ _useLimitedUseAppCheckTokens);
}
///
@@ -230,7 +238,8 @@ public ImagenModel GetImagenModel(
RequestOptions? requestOptions = null)
{
return new ImagenModel(_firebaseApp, _backend, modelName,
- generationConfig, safetySettings, requestOptions);
+ generationConfig, safetySettings, requestOptions,
+ _useLimitedUseAppCheckTokens);
}
///
@@ -241,7 +250,8 @@ public ImagenModel GetImagenModel(
public TemplateGenerativeModel GetTemplateGenerativeModel(
RequestOptions? requestOptions = null)
{
- return new TemplateGenerativeModel(_firebaseApp, _backend, requestOptions);
+ return new TemplateGenerativeModel(_firebaseApp, _backend, requestOptions,
+ _useLimitedUseAppCheckTokens);
}
///
@@ -259,7 +269,8 @@ public TemplateGenerativeModel GetTemplateGenerativeModel(
public TemplateImagenModel GetTemplateImagenModel(
RequestOptions? requestOptions = null)
{
- return new TemplateImagenModel(_firebaseApp, _backend, requestOptions);
+ return new TemplateImagenModel(_firebaseApp, _backend, requestOptions,
+ _useLimitedUseAppCheckTokens);
}
}
diff --git a/firebaseai/src/GenerativeModel.cs b/firebaseai/src/GenerativeModel.cs
index 33be1eec..f925524b 100644
--- a/firebaseai/src/GenerativeModel.cs
+++ b/firebaseai/src/GenerativeModel.cs
@@ -45,6 +45,7 @@ public class GenerativeModel
private readonly ToolConfig? _toolConfig;
private readonly ModelContent? _systemInstruction;
private readonly RequestOptions? _requestOptions;
+ private readonly bool _useLimitedUseAppCheckTokens;
private readonly HttpClient _httpClient;
// String prefix to look for when handling streaming a response.
@@ -62,7 +63,8 @@ internal GenerativeModel(FirebaseApp firebaseApp,
Tool[] tools = null,
ToolConfig? toolConfig = null,
ModelContent? systemInstruction = null,
- RequestOptions? requestOptions = null)
+ RequestOptions? requestOptions = null,
+ bool useLimitedUseAppCheckTokens = false)
{
_firebaseApp = firebaseApp;
_backend = backend;
@@ -74,6 +76,7 @@ internal GenerativeModel(FirebaseApp firebaseApp,
// Make sure that the system instructions have the role "system".
_systemInstruction = systemInstruction?.ConvertToSystem();
_requestOptions = requestOptions;
+ _useLimitedUseAppCheckTokens = useLimitedUseAppCheckTokens;
// Create a HttpClient using the timeout requested, or the default one.
_httpClient = new HttpClient()
@@ -272,7 +275,7 @@ private async Task GenerateContentAsyncInternal(
Firebase.AI.Internal.HttpHelpers.GetURL(_firebaseApp, _backend, _modelName) + ":generateContent");
// Set the request headers
- await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp);
+ await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens);
// Set the content
string bodyJson = MakeGenerateContentRequest(content);
@@ -302,7 +305,7 @@ private async IAsyncEnumerable GenerateContentStreamAsy
Firebase.AI.Internal.HttpHelpers.GetURL(_firebaseApp, _backend, _modelName) + ":streamGenerateContent?alt=sse");
// Set the request headers
- await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp);
+ await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens);
// Set the content
string bodyJson = MakeGenerateContentRequest(content);
@@ -342,7 +345,7 @@ private async Task CountTokensAsyncInternal(
Firebase.AI.Internal.HttpHelpers.GetURL(_firebaseApp, _backend, _modelName) + ":countTokens");
// Set the request headers
- await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp);
+ await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens);
// Set the content
string bodyJson = MakeCountTokensRequest(content);
diff --git a/firebaseai/src/Imagen/ImagenModel.cs b/firebaseai/src/Imagen/ImagenModel.cs
index 99a2e03f..00335e9a 100644
--- a/firebaseai/src/Imagen/ImagenModel.cs
+++ b/firebaseai/src/Imagen/ImagenModel.cs
@@ -49,6 +49,7 @@ public class ImagenModel
private readonly ImagenGenerationConfig? _generationConfig;
private readonly ImagenSafetySettings? _safetySettings;
private readonly RequestOptions? _requestOptions;
+ private readonly bool _useLimitedUseAppCheckTokens;
private readonly HttpClient _httpClient;
@@ -61,7 +62,8 @@ internal ImagenModel(FirebaseApp firebaseApp,
string modelName,
ImagenGenerationConfig? generationConfig = null,
ImagenSafetySettings? safetySettings = null,
- RequestOptions? requestOptions = null)
+ RequestOptions? requestOptions = null,
+ bool useLimitedUseAppCheckTokens = false)
{
_firebaseApp = firebaseApp;
_backend = backend;
@@ -69,6 +71,7 @@ internal ImagenModel(FirebaseApp firebaseApp,
_generationConfig = generationConfig;
_safetySettings = safetySettings;
_requestOptions = requestOptions;
+ _useLimitedUseAppCheckTokens = useLimitedUseAppCheckTokens;
// Create a HttpClient using the timeout requested, or the default one.
_httpClient = new HttpClient()
@@ -101,7 +104,7 @@ private async Task> GenerateImagesAs
Firebase.AI.Internal.HttpHelpers.GetURL(_firebaseApp, _backend, _modelName) + ":predict");
// Set the request headers
- await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp);
+ await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens);
// Set the content
string bodyJson = MakeGenerateImagenRequest(prompt);
@@ -182,6 +185,7 @@ public class TemplateImagenModel
{
private readonly FirebaseApp _firebaseApp;
private readonly FirebaseAI.Backend _backend;
+ private readonly bool _useLimitedUseAppCheckTokens;
private readonly HttpClient _httpClient;
@@ -190,10 +194,12 @@ public class TemplateImagenModel
/// Use `FirebaseAI.GetTemplateImagenModel` instead to ensure proper initialization and configuration of the `TemplateImagenModel`.
///
internal TemplateImagenModel(FirebaseApp firebaseApp,
- FirebaseAI.Backend backend, RequestOptions? requestOptions = null)
+ FirebaseAI.Backend backend, RequestOptions? requestOptions = null,
+ bool useLimitedUseAppCheckTokens = false)
{
_firebaseApp = firebaseApp;
_backend = backend;
+ _useLimitedUseAppCheckTokens = useLimitedUseAppCheckTokens;
// Create a HttpClient using the timeout requested, or the default one.
_httpClient = new HttpClient()
@@ -217,7 +223,7 @@ public async Task> GenerateImagesAsy
Firebase.AI.Internal.HttpHelpers.GetTemplateURL(_firebaseApp, _backend, templateId) + ":templatePredict");
// Set the request headers
- await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp);
+ await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens);
// Set the content
Dictionary jsonDict = new()
diff --git a/firebaseai/src/LiveGenerativeModel.cs b/firebaseai/src/LiveGenerativeModel.cs
index 99c0aca2..80d13b1f 100644
--- a/firebaseai/src/LiveGenerativeModel.cs
+++ b/firebaseai/src/LiveGenerativeModel.cs
@@ -49,6 +49,7 @@ public class LiveGenerativeModel
private readonly Tool[] _tools;
private readonly ModelContent? _systemInstruction;
private readonly RequestOptions? _requestOptions;
+ private readonly bool _useLimitedUseAppCheckTokens;
///
/// Intended for internal use only.
@@ -60,7 +61,8 @@ internal LiveGenerativeModel(FirebaseApp firebaseApp,
LiveGenerationConfig? liveConfig = null,
Tool[] tools = null,
ModelContent? systemInstruction = null,
- RequestOptions? requestOptions = null)
+ RequestOptions? requestOptions = null,
+ bool useLimitedUseAppCheckTokens = false)
{
_firebaseApp = firebaseApp;
_backend = backend;
@@ -69,6 +71,7 @@ internal LiveGenerativeModel(FirebaseApp firebaseApp,
_tools = tools;
_systemInstruction = systemInstruction;
_requestOptions = requestOptions;
+ _useLimitedUseAppCheckTokens = useLimitedUseAppCheckTokens;
}
private string GetURL()
@@ -126,7 +129,7 @@ private async Task CreateClientWebSocketAsync(CancellationToken
clientWebSocket.Options.SetRequestHeader("X-Firebase-AppVersion", UnityEngine.Application.version);
}
// Add additional Firebase tokens to the header.
- await Firebase.Internal.FirebaseInterops.AddFirebaseTokensAsync(clientWebSocket, _firebaseApp);
+ await Firebase.Internal.FirebaseInterops.AddFirebaseTokensAsync(clientWebSocket, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens);
// Add a timeout to the initial connection, using the RequestOptions.
using var connectionCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
diff --git a/firebaseai/src/TemplateGenerativeModel.cs b/firebaseai/src/TemplateGenerativeModel.cs
index 61376907..7e4a8e5b 100644
--- a/firebaseai/src/TemplateGenerativeModel.cs
+++ b/firebaseai/src/TemplateGenerativeModel.cs
@@ -36,6 +36,7 @@ public class TemplateGenerativeModel
private readonly FirebaseApp _firebaseApp;
private readonly FirebaseAI.Backend _backend;
private readonly RequestOptions? _requestOptions;
+ private readonly bool _useLimitedUseAppCheckTokens;
private readonly HttpClient _httpClient;
@@ -46,10 +47,12 @@ public class TemplateGenerativeModel
///
internal TemplateGenerativeModel(FirebaseApp firebaseApp,
FirebaseAI.Backend backend,
- RequestOptions? requestOptions = null)
+ RequestOptions? requestOptions = null,
+ bool useLimitedUseAppCheckTokens = false)
{
_firebaseApp = firebaseApp;
_backend = backend;
+ _useLimitedUseAppCheckTokens = useLimitedUseAppCheckTokens;
// Create a HttpClient using the timeout requested, or the default one.
_httpClient = new HttpClient()
@@ -148,7 +151,7 @@ private async Task GenerateContentAsyncInternal(
Firebase.AI.Internal.HttpHelpers.GetTemplateURL(_firebaseApp, _backend, templateId) + ":templateGenerateContent");
// Set the request headers
- await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp);
+ await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens);
// Set the content
string bodyJson = MakeGenerateContentRequest(inputs, chatHistory, tools, toolConfig);
@@ -181,7 +184,7 @@ private async IAsyncEnumerable GenerateContentStreamAsy
Firebase.AI.Internal.HttpHelpers.GetTemplateURL(_firebaseApp, _backend, templateId) + ":templateStreamGenerateContent?alt=sse");
// Set the request headers
- await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp);
+ await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens);
// Set the content
string bodyJson = MakeGenerateContentRequest(inputs, chatHistory, tools, toolConfig);
diff --git a/firebaseai/testapp/Assets/Firebase/Sample/Firebase.FirebaseAI.TestApp.asmdef b/firebaseai/testapp/Assets/Firebase/Sample/Firebase.FirebaseAI.TestApp.asmdef
index dac44f00..b08f7890 100644
--- a/firebaseai/testapp/Assets/Firebase/Sample/Firebase.FirebaseAI.TestApp.asmdef
+++ b/firebaseai/testapp/Assets/Firebase/Sample/Firebase.FirebaseAI.TestApp.asmdef
@@ -13,7 +13,8 @@
"Firebase.App.dll",
"Firebase.Platform.dll",
"Google.MiniJson.dll",
- "Firebase.TaskExtension.dll"
+ "Firebase.TaskExtension.dll",
+ "Firebase.AppCheck.dll"
],
"autoReferenced": true,
"defineConstraints": [],
diff --git a/firebaseai/testapp/Assets/Firebase/Sample/FirebaseAI/UIHandler.cs b/firebaseai/testapp/Assets/Firebase/Sample/FirebaseAI/UIHandler.cs
index 46371f52..dcb8f4b5 100644
--- a/firebaseai/testapp/Assets/Firebase/Sample/FirebaseAI/UIHandler.cs
+++ b/firebaseai/testapp/Assets/Firebase/Sample/FirebaseAI/UIHandler.cs
@@ -16,6 +16,7 @@ namespace Firebase.Sample.FirebaseAI {
using Firebase;
using Firebase.AI;
using Firebase.Extensions;
+ using Firebase.AppCheck;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -40,8 +41,18 @@ public class UIHandler : MonoBehaviour {
private DependencyStatus dependencyStatus = DependencyStatus.UnavailableOther;
+ private string appCheckDebugToken = "REPLACE_WITH_APP_CHECK_TOKEN";
+
+ protected void InitializeAppCheck() {
+ DebugLog("Initializing App Check directly in manual UIHandler");
+ DebugAppCheckProviderFactory.Instance.SetDebugToken(appCheckDebugToken);
+ FirebaseAppCheck.SetAppCheckProviderFactory(DebugAppCheckProviderFactory.Instance);
+ }
+
protected virtual void Start() {
UIEnabled = true;
+ InitializeAppCheck();
+ InitializeFirebase();
}
protected void InitializeFirebase() {
@@ -65,7 +76,7 @@ private GenerativeModel GetModel() {
? FirebaseAI.Backend.GoogleAI()
: FirebaseAI.Backend.VertexAI();
- return FirebaseAI.GetInstance(backend).GetGenerativeModel(ModelName);
+ return FirebaseAI.GetInstance(backend, useLimitedUseAppCheckTokens: true).GetGenerativeModel(ModelName);
}
// Send a single message to the Generative Model, without any history.
diff --git a/firebaseai/testapp/Assets/Firebase/Sample/FirebaseAI/UIHandlerAutomated.cs b/firebaseai/testapp/Assets/Firebase/Sample/FirebaseAI/UIHandlerAutomated.cs
index bc18053c..8f20fb6f 100644
--- a/firebaseai/testapp/Assets/Firebase/Sample/FirebaseAI/UIHandlerAutomated.cs
+++ b/firebaseai/testapp/Assets/Firebase/Sample/FirebaseAI/UIHandlerAutomated.cs
@@ -36,6 +36,7 @@ namespace Firebase.Sample.FirebaseAI
#if INCLUDE_FIREBASE_AUTH
using Firebase.Auth;
#endif
+ using Firebase.AppCheck;
// An automated version of the UIHandler that runs tests on Firebase AI.
public class UIHandlerAutomated : UIHandler
@@ -45,6 +46,15 @@ public class UIHandlerAutomated : UIHandler
private Firebase.Sample.AutomatedTestRunner testRunner;
+ private string appCheckDebugTokenForAutomated = "REPLACE_WITH_APP_CHECK_TOKEN";
+
+ protected void InitializeAppCheck()
+ {
+ DebugLog("Initializing App Check directly in automated handler");
+ DebugAppCheckProviderFactory.Instance.SetDebugToken(appCheckDebugTokenForAutomated);
+ FirebaseAppCheck.SetAppCheckProviderFactory(DebugAppCheckProviderFactory.Instance);
+ }
+
// Texture used for tests involving images.
public Texture2D RedBlueTexture;
@@ -131,6 +141,7 @@ private async Task RetryTestWithExponentialBackoff(string testName, Func t
protected override void Start()
{
+ InitializeAppCheck();
// Set of tests that use multiple backends.
// When running on CI, these tests will be run on all devices
Func[] basicMultiBackendTests = {
@@ -138,7 +149,10 @@ protected override void Start()
TestBasicText,
TestBasicImage,
TestModelOptions,
- TestCountTokens
+ TestCountTokens,
+ TestFirebaseAIInstanceCaching,
+ TestLiveModel,
+ TestImagen
};
// When running on CI, these tests are only run in the Editor
Func[] editorMultiBackendTests = {
@@ -302,12 +316,12 @@ private bool ValidProbability(float value)
// The model name to use for the tests.
private readonly string TestModelName = "gemini-3.1-flash-lite";
- private FirebaseAI GetFirebaseAI(Backend backend, string location = "global")
+ private FirebaseAI GetFirebaseAI(Backend backend, string location = "global", bool useLimitedUseAppCheckTokens = true)
{
return backend switch
{
- Backend.GoogleAI => FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI()),
- Backend.VertexAI => FirebaseAI.GetInstance(FirebaseAI.Backend.VertexAI(location)),
+ Backend.GoogleAI => FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI(), useLimitedUseAppCheckTokens),
+ Backend.VertexAI => FirebaseAI.GetInstance(FirebaseAI.Backend.VertexAI(location), useLimitedUseAppCheckTokens),
_ => throw new ArgumentOutOfRangeException(nameof(backend), backend,
"Unhandled Backend type"),
};
@@ -327,6 +341,52 @@ Task TestCreateModel(Backend backend)
return Task.CompletedTask;
}
+ // Test that FirebaseAI instances are correctly cached based on limited use settings.
+ Task TestFirebaseAIInstanceCaching(Backend backend)
+ {
+ var ai1 = GetFirebaseAI(backend, useLimitedUseAppCheckTokens: false);
+ var ai2 = GetFirebaseAI(backend, useLimitedUseAppCheckTokens: true);
+ var ai3 = GetFirebaseAI(backend, useLimitedUseAppCheckTokens: false);
+
+ Assert("Instances with different limited use settings should be different.", ai1 != ai2);
+ Assert("Instances with the same limited use settings should be the same.", ai1 == ai3);
+ return Task.CompletedTask;
+ }
+
+ // Test if the Live model works with the default backend.
+ async Task TestLiveModel(Backend backend)
+ {
+ var ai = GetFirebaseAI(backend);
+ // Only the flash-live models support the Live API.
+ var model = ai.GetLiveModel("gemini-2.0-flash-exp");
+
+ // We can't easily verify that the token used is a limited use one without a mock backend,
+ // but we can at least verify that the connection succeeds and we get a response.
+ using var session = await model.ConnectAsync();
+ await session.SendTextRealtimeAsync("Say hello");
+
+ await foreach (var response in session.ReceiveAsync())
+ {
+ Assert("Response text was empty.", !string.IsNullOrEmpty(response.Text));
+ // We only care about the first response for this test.
+ break;
+ }
+ }
+
+ // Test if the Imagen model works with the default backend.
+ async Task TestImagen(Backend backend)
+ {
+ var ai = GetFirebaseAI(backend);
+ #pragma warning disable
+ var model = ai.GetImagenModel("imagen-3.0-generate-002");
+ #pragma warning restore
+
+ // We can't easily verify that the token used is a limited use one without a mock backend,
+ // but we can at least verify that the request succeeds.
+ var response = await model.GenerateImagesAsync("Generate an image of a cartoon dog.");
+ Assert("Response missing images.", response.Images.Any());
+ }
+
// Test if it can set a string in, and get a string output.
async Task TestBasicText(Backend backend)
{
diff --git a/scripts/gha/integration_testing/build_testapps.json b/scripts/gha/integration_testing/build_testapps.json
index d844a28d..de2da00e 100644
--- a/scripts/gha/integration_testing/build_testapps.json
+++ b/scripts/gha/integration_testing/build_testapps.json
@@ -95,12 +95,14 @@
"testapp_path": "firebaseai/testapp",
"platforms": ["Android", "Playmode", "iOS", "tvOS", "Windows", "macOS", "Linux"],
"plugins": [
- "FirebaseAI.unitypackage"
+ "FirebaseAI.unitypackage",
+ "FirebaseAppCheck.unitypackage"
],
"provision": "Firebase_Dev_Wildcard.mobileprovision",
"upm_packages": [
"com.google.external-dependency-manager-*.tgz",
"com.google.firebase.app-*.tgz",
+ "com.google.firebase.app-check-*.tgz",
"com.google.firebase.firebaseai-*.tgz"
]
},
diff --git a/scripts/gha/restore_secrets.py b/scripts/gha/restore_secrets.py
index 7ddd0fb6..153d4565 100644
--- a/scripts/gha/restore_secrets.py
+++ b/scripts/gha/restore_secrets.py
@@ -131,6 +131,10 @@ def main(argv):
_patch_file(file_path, "REPLACE_WITH_APP_CHECK_TOKEN", debug_token)
file_path = os.path.join(repo_dir, "functions", "testapp", "Assets", "Firebase", "Sample", CAPITALIZATIONS["functions"], "UIHandlerAutomated.cs")
_patch_file(file_path, "REPLACE_WITH_APP_CHECK_TOKEN", debug_token)
+ file_path = os.path.join(repo_dir, "firebaseai", "testapp", "Assets", "Firebase", "Sample", CAPITALIZATIONS["firebaseai"], "UIHandlerAutomated.cs")
+ _patch_file(file_path, "REPLACE_WITH_APP_CHECK_TOKEN", debug_token)
+ file_path = os.path.join(repo_dir, "firebaseai", "testapp", "Assets", "Firebase", "Sample", CAPITALIZATIONS["firebaseai"], "UIHandler.cs")
+ _patch_file(file_path, "REPLACE_WITH_APP_CHECK_TOKEN", debug_token)
print("Attempting to decrypt GCS service account key file.")