Skip to content

Commit bf43d7d

Browse files
committed
Merge branch 'main' into dl/map-expressions
2 parents 428d4f5 + 1994969 commit bf43d7d

18 files changed

Lines changed: 104 additions & 409 deletions

File tree

ai-logic/firebase-ai/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Unreleased
22

3-
- [feature] Added support for [Maps Grounding](https://ai.google.dev/gemini-api/docs/maps-grounding) (#7950)
43
- [fixed] Fixed an issue causing network timeouts to throw the incorrect exception type, instead of
54
`RequestTimeoutException` (#7966)
5+
- [fixed] Fixed missing `toString()` implemenation for `InferenceSource` (#7970)
6+
- [fixed] Fixed an issue causing the SDK to throw an exception if an unknown message was received
7+
from the LiveAPI model, instead of ignoring it (#7975)
68

79
# 17.10.1
810

ai-logic/firebase-ai/api.txt

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -637,20 +637,6 @@ package com.google.firebase.ai.type {
637637
method public com.google.firebase.ai.type.GenerativeBackend vertexAI(String location = "us-central1");
638638
}
639639

640-
public final class GoogleMaps {
641-
ctor public GoogleMaps();
642-
}
643-
644-
public final class GoogleMapsGroundingChunk {
645-
ctor public GoogleMapsGroundingChunk(String? uri, String? title, String? placeId);
646-
method public String? getPlaceId();
647-
method public String? getTitle();
648-
method public String? getUri();
649-
property public final String? placeId;
650-
property public final String? title;
651-
property public final String? uri;
652-
}
653-
654640
public final class GoogleSearch {
655641
ctor public GoogleSearch();
656642
}
@@ -664,12 +650,8 @@ package com.google.firebase.ai.type {
664650
}
665651

666652
public final class GroundingChunk {
667-
ctor public GroundingChunk();
668-
ctor public GroundingChunk(com.google.firebase.ai.type.WebGroundingChunk? web = null);
669-
ctor public GroundingChunk(com.google.firebase.ai.type.WebGroundingChunk? web = null, com.google.firebase.ai.type.GoogleMapsGroundingChunk? maps = null);
670-
method public com.google.firebase.ai.type.GoogleMapsGroundingChunk? getMaps();
653+
ctor public GroundingChunk(com.google.firebase.ai.type.WebGroundingChunk? web);
671654
method public com.google.firebase.ai.type.WebGroundingChunk? getWeb();
672-
property public final com.google.firebase.ai.type.GoogleMapsGroundingChunk? maps;
673655
property public final com.google.firebase.ai.type.WebGroundingChunk? web;
674656
}
675657

@@ -1185,17 +1167,6 @@ package com.google.firebase.ai.type {
11851167
method public com.google.firebase.ai.type.JsonSchema<java.lang.String> string(String? description = null, boolean nullable = false, com.google.firebase.ai.type.StringFormat? format = null, String? title = null);
11861168
}
11871169

1188-
public final class LatLng {
1189-
ctor public LatLng(double latitude, double longitude);
1190-
method public double component1();
1191-
method public double component2();
1192-
method public com.google.firebase.ai.type.LatLng copy(double latitude, double longitude);
1193-
method public double getLatitude();
1194-
method public double getLongitude();
1195-
property public final double latitude;
1196-
property public final double longitude;
1197-
}
1198-
11991170
@com.google.firebase.ai.type.PublicPreviewAPI public final class LiveAudioConversationConfig {
12001171
field public static final com.google.firebase.ai.type.LiveAudioConversationConfig.Companion Companion;
12011172
}
@@ -1301,6 +1272,9 @@ package com.google.firebase.ai.type {
13011272
property public final java.util.List<java.lang.String> functionIds;
13021273
}
13031274

1275+
@com.google.firebase.ai.type.PublicPreviewAPI public final class LiveServerUnknownMessage implements com.google.firebase.ai.type.LiveServerMessage {
1276+
}
1277+
13041278
@com.google.firebase.ai.type.PublicPreviewAPI public final class LiveSession {
13051279
method public suspend Object? close(kotlin.coroutines.Continuation<? super kotlin.Unit>);
13061280
method public boolean isAudioConversationActive();
@@ -1402,28 +1376,6 @@ package com.google.firebase.ai.type {
14021376
property public final com.google.firebase.ai.type.GenerateContentResponse response;
14031377
}
14041378

1405-
public final class RetrievalConfig {
1406-
method public static com.google.firebase.ai.type.RetrievalConfig.Builder builder();
1407-
field public static final com.google.firebase.ai.type.RetrievalConfig.Companion Companion;
1408-
}
1409-
1410-
public static final class RetrievalConfig.Builder {
1411-
ctor public RetrievalConfig.Builder();
1412-
method public com.google.firebase.ai.type.RetrievalConfig build();
1413-
method public com.google.firebase.ai.type.RetrievalConfig.Builder setLanguageCode(String? languageCode);
1414-
method public com.google.firebase.ai.type.RetrievalConfig.Builder setLatLng(com.google.firebase.ai.type.LatLng? latLng);
1415-
field public String? languageCode;
1416-
field public com.google.firebase.ai.type.LatLng? latLng;
1417-
}
1418-
1419-
public static final class RetrievalConfig.Companion {
1420-
method public com.google.firebase.ai.type.RetrievalConfig.Builder builder();
1421-
}
1422-
1423-
public final class RetrievalConfigKt {
1424-
method public static com.google.firebase.ai.type.RetrievalConfig retrievalConfig(kotlin.jvm.functions.Function1<? super com.google.firebase.ai.type.RetrievalConfig.Builder,kotlin.Unit> init);
1425-
}
1426-
14271379
public final class SafetyRating {
14281380
method public Boolean? getBlocked();
14291381
method public com.google.firebase.ai.type.HarmCategory getCategory();
@@ -1666,8 +1618,6 @@ package com.google.firebase.ai.type {
16661618
method public static com.google.firebase.ai.type.Tool codeExecution();
16671619
method public static com.google.firebase.ai.type.Tool functionDeclarations(java.util.List<com.google.firebase.ai.type.FunctionDeclaration> functionDeclarations);
16681620
method public static com.google.firebase.ai.type.Tool functionDeclarations(java.util.List<com.google.firebase.ai.type.FunctionDeclaration>? functionDeclarations = null, java.util.List<? extends com.google.firebase.ai.type.AutoFunctionDeclaration<? extends java.lang.Object?,? extends java.lang.Object?>>? autoFunctionDeclarations);
1669-
method public static com.google.firebase.ai.type.Tool googleMaps();
1670-
method public static com.google.firebase.ai.type.Tool googleMaps(com.google.firebase.ai.type.GoogleMaps googleMaps = com.google.firebase.ai.type.GoogleMaps());
16711621
method public static com.google.firebase.ai.type.Tool googleSearch();
16721622
method public static com.google.firebase.ai.type.Tool googleSearch(com.google.firebase.ai.type.GoogleSearch googleSearch = com.google.firebase.ai.type.GoogleSearch());
16731623
method public static com.google.firebase.ai.type.Tool urlContext();
@@ -1679,18 +1629,14 @@ package com.google.firebase.ai.type {
16791629
method public com.google.firebase.ai.type.Tool codeExecution();
16801630
method public com.google.firebase.ai.type.Tool functionDeclarations(java.util.List<com.google.firebase.ai.type.FunctionDeclaration> functionDeclarations);
16811631
method public com.google.firebase.ai.type.Tool functionDeclarations(java.util.List<com.google.firebase.ai.type.FunctionDeclaration>? functionDeclarations = null, java.util.List<? extends com.google.firebase.ai.type.AutoFunctionDeclaration<? extends java.lang.Object?,? extends java.lang.Object?>>? autoFunctionDeclarations);
1682-
method public com.google.firebase.ai.type.Tool googleMaps();
1683-
method public com.google.firebase.ai.type.Tool googleMaps(com.google.firebase.ai.type.GoogleMaps googleMaps = com.google.firebase.ai.type.GoogleMaps());
16841632
method public com.google.firebase.ai.type.Tool googleSearch();
16851633
method public com.google.firebase.ai.type.Tool googleSearch(com.google.firebase.ai.type.GoogleSearch googleSearch = com.google.firebase.ai.type.GoogleSearch());
16861634
method public com.google.firebase.ai.type.Tool urlContext();
16871635
method public com.google.firebase.ai.type.Tool urlContext(com.google.firebase.ai.type.UrlContext urlContext = com.google.firebase.ai.type.UrlContext());
16881636
}
16891637

16901638
public final class ToolConfig {
1691-
ctor public ToolConfig();
1692-
ctor public ToolConfig(com.google.firebase.ai.type.FunctionCallingConfig? functionCallingConfig = null);
1693-
ctor public ToolConfig(com.google.firebase.ai.type.FunctionCallingConfig? functionCallingConfig = null, com.google.firebase.ai.type.RetrievalConfig? retrievalConfig = null);
1639+
ctor public ToolConfig(com.google.firebase.ai.type.FunctionCallingConfig? functionCallingConfig);
16941640
}
16951641

16961642
public final class Transcription {

ai-logic/firebase-ai/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version=17.11.0
15+
version=17.10.2
1616
latestReleasedVersion=17.10.1

ai-logic/firebase-ai/src/androidTest/kotlin/com/google/firebase/ai/GroundingTests.kt

Lines changed: 0 additions & 73 deletions
This file was deleted.

ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Candidate.kt

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,6 @@ public class FinishReason private constructor(public val name: String, public va
336336
* Vertex AI Gemini API (see [Service Terms](https://cloud.google.com/terms/service-terms) section
337337
* within the Service Specific Terms).
338338
*
339-
* If using Grounding with Google Maps, you are required to comply with the "Grounding with Google
340-
* Maps" usage requirements for your chosen API provider:
341-
* [Gemini Developer API](https://ai.google.dev/gemini-api/terms#grounding-with-google-maps) or
342-
* Vertex AI Gemini API (see [Service Terms](https://cloud.google.com/terms/service-terms) section
343-
* within the Service Specific Terms).
344-
*
345339
* @property webSearchQueries The list of web search queries that the model performed to gather the
346340
* grounding information. These can be used to allow users to explore the search results themselves.
347341
* @property searchEntryPoint Google Search entry point for web searches. This contains an HTML/CSS
@@ -414,40 +408,15 @@ public class SearchEntryPoint(
414408
* Represents a chunk of retrieved data that supports a claim in the model's response.
415409
*
416410
* @property web Contains details if the grounding chunk is from a web source.
417-
* @property maps Contains details if the grounding chunk is from a Google Maps source.
418411
*/
419-
public class GroundingChunk
420-
@JvmOverloads
421-
constructor(
422-
public val web: WebGroundingChunk? = null,
423-
public val maps: GoogleMapsGroundingChunk? = null,
412+
public class GroundingChunk(
413+
public val web: WebGroundingChunk?,
424414
) {
425-
426415
@Serializable
427416
internal data class Internal(
428417
val web: WebGroundingChunk.Internal?,
429-
val maps: GoogleMapsGroundingChunk.Internal?,
430418
) {
431-
internal fun toPublic() = GroundingChunk(web = web?.toPublic(), maps?.toPublic())
432-
}
433-
}
434-
435-
/**
436-
* A grounding chunk from Google Maps.
437-
*
438-
* @property uri The URI of the place.
439-
* @property title The title of the place.
440-
* @property placeId This Place's resource name, in `places/{place_id}` format. This can be used to
441-
* look up the place using the Google Maps API.
442-
*/
443-
public class GoogleMapsGroundingChunk(
444-
public val uri: String?,
445-
public val title: String?,
446-
public val placeId: String?,
447-
) {
448-
@Serializable
449-
internal data class Internal(val uri: String?, val title: String?, val placeId: String?) {
450-
fun toPublic() = GoogleMapsGroundingChunk(uri, title, placeId)
419+
internal fun toPublic() = GroundingChunk(web = web?.toPublic())
451420
}
452421
}
453422

ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/GoogleMaps.kt

Lines changed: 0 additions & 35 deletions
This file was deleted.

ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/LatLng.kt

Lines changed: 0 additions & 34 deletions
This file was deleted.

ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/LiveServerMessage.kt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.firebase.ai.type
1818

19+
import android.util.Log
1920
import kotlin.time.Duration
2021
import kotlin.time.Duration.Companion.seconds
2122
import kotlinx.serialization.DeserializationStrategy
@@ -136,6 +137,15 @@ public class LiveServerSetupComplete : LiveServerMessage {
136137
}
137138
}
138139

140+
@PublicPreviewAPI
141+
public class LiveServerUnknownMessage private constructor() : LiveServerMessage {
142+
@Serializable
143+
internal data class InternalWrapper(@Transient val unused: Unit? = null) :
144+
InternalLiveServerMessage {
145+
override fun toPublic() = LiveServerUnknownMessage()
146+
}
147+
}
148+
139149
/**
140150
* Request for the client to execute the provided [functionCalls].
141151
*
@@ -233,10 +243,13 @@ internal object LiveServerMessageSerializer :
233243
"toolCallCancellation" in jsonObject ->
234244
LiveServerToolCallCancellation.InternalWrapper.serializer()
235245
"goAway" in jsonObject -> LiveServerGoAway.InternalWrapper.serializer()
236-
else ->
237-
throw SerializationException(
238-
"Unknown LiveServerMessage response type. Keys found: ${jsonObject.keys}"
246+
else -> {
247+
Log.w(
248+
"LiveServerMsgSerializer",
249+
"Ignoring unknown LiveServerMessage response type. Keys found: ${jsonObject.keys}"
239250
)
251+
LiveServerUnknownMessage.InternalWrapper.serializer()
252+
}
240253
}
241254
}
242255
}

ai-logic/firebase-ai/src/main/kotlin/com/google/firebase/ai/type/LiveSession.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ internal constructor(
578578
// Notify the application
579579
goAwayHandler?.invoke(it)
580580
}
581+
is LiveServerUnknownMessage -> {} // Ignore. Logging happens at de-serialization time
581582
}
582583
}
583584
.launchIn(networkScope)

0 commit comments

Comments
 (0)