You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am declaring a function with Schema.bool("grewUpIn", "Whether the user grew up in this location or not."), and when Gemini call my function I get the following error:
com.google.firebase.vertexai.type.SerializationException: Something went wrong while trying to deserialize a response from the server.
17:17:45.834 I at com.google.firebase.vertexai.type.FirebaseVertexAIException$Companion.from(Exceptions.kt:41)
17:17:45.834 I at com.google.firebase.vertexai.GenerativeModel$generateContentStream$1.invokeSuspend(GenerativeModel.kt:147)
17:17:45.834 I at com.google.firebase.vertexai.GenerativeModel$generateContentStream$1.invoke(Unknown Source:9)
17:17:45.834 I at com.google.firebase.vertexai.GenerativeModel$generateContentStream$1.invoke(Unknown Source:6)
17:17:45.834 I at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catch$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:113)
17:17:45.834 I at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catch$$inlined$unsafeFlow$1$1.invokeSuspend(Unknown Source:15)
17:17:45.834 I at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
17:17:45.834 I at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:28)
17:17:45.834 I at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:99)
17:17:45.834 I at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
17:17:45.835 I at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:102)
17:17:45.835 I at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
17:17:45.835 I at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
17:17:45.835 I at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(AndroidUiDispatcher.android.kt:57)
17:17:45.835 I at android.os.Handler.handleCallback(Handler.java:942)
17:17:45.835 I at android.os.Handler.dispatchMessage(Handler.java:99)
17:17:45.835 I at android.os.Looper.loopOnce(Looper.java:201)
17:17:45.835 I at android.os.Looper.loop(Looper.java:288)
17:17:45.835 I at android.app.ActivityThread.main(ActivityThread.java:7918)
17:17:45.835 I at java.lang.reflect.Method.invoke(Native Method)
17:17:45.835 I at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
17:17:45.835 I at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
17:17:45.835 I Caused by: kotlinx.serialization.json.internal.JsonDecodingException: String literal for key 'grewUpIn' should be quoted at element: $.grewUpIn.
17:17:45.835 I Use 'isLenient = true' in 'Json {}' builder to accept non-compliant JSON.
17:17:45.835 I JSON input: {"yearsLived":"12","country":"US","grewUpIn":false,"region":""}
17:17:45.835 I at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24)
17:17:45.835 I at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:32)
17:17:45.835 I at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeTaggedString(TreeJsonDecoder.kt:150)
17:17:45.835 I at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeTaggedString(TreeJsonDecoder.kt:37)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.decodeString(Tagged.kt:231)
17:17:45.835 I at kotlinx.serialization.internal.StringSerializer.deserialize(Primitives.kt:160)
17:17:45.835 I at kotlinx.serialization.internal.StringSerializer.deserialize(Primitives.kt:156)
17:17:45.835 I at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:337)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableValue(Tagged.kt:207)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement$lambda$1(Tagged.kt:279)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.$r8$lambda$DBYIndnlKB76_oyt-Ap4f_T35nM(Unknown Source:0)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder$$ExternalSyntheticLambda0.invoke(D8$$SyntheticClass:0)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.tagBlock(Tagged.kt:294)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement(Tagged.kt:279)
17:17:45.835 I at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:538)
17:17:45.835 I at kotlinx.serialization.internal.MapLikeSerializer.readElement(CollectionSerializers.kt:111)
17:17:45.835 I at kotlinx.serialization.internal.MapLikeSerializer.readElement(CollectionSerializers.kt:84)
17:17:45.835 I at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
17:17:45.835 I at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
17:17:45.835 I at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
17:17:45.835 I at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:337)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableValue(Tagged.kt:207)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement$lambda$1(Tagged.kt:279)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.$r8$lambda$DBYIndnlKB76_oyt-Ap4f_T35nM(Unknown Source:0)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder$$ExternalSyntheticLambda0.invoke(D8$$SyntheticClass:0)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.tagBlock(Tagged.kt:294)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement(Tagged.kt:279)
17:17:45.835 I at com.google.ai.client.generativeai.common.shared.FunctionCall$$serializer.deserialize(Types.kt:62)
17:17:45.835 I at com.google.ai.client.generativeai.common.shared.FunctionCall$$serializer.deserialize(Types.kt:62)
17:17:45.835 I at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:337)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableValue(Tagged.kt:207)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement$lambda$1(Tagged.kt:279)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.$r8$lambda$DBYIndnlKB76_oyt-Ap4f_T35nM(Unknown Source:0)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder$$ExternalSyntheticLambda0.invoke(D8$$SyntheticClass:0)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.tagBlock(Tagged.kt:294)
17:17:45.835 I at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement(Tagged.kt:279)
17:17:45.835 I at com.google.ai.client.generativeai.common.shared.FunctionCallPart$$serializer.deserialize(Types.kt:56)
17:17:45.835 I at com.google.ai.client.generativeai.common.shared.FunctionCallPart$$serializer.deserialize(Types.kt:56)
17:17:45.835 I at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:337)
17:17:45.835 I at kotlinx.serialization.json.internal.TreeJsonDecoderKt.readJson(TreeJsonDecoder.kt:26)
17:17:45.835 I at kotlinx.serialization.json.Json.decodeFromJsonElement(Json.kt:186)
17:17:45.835 I at kotlinx.serialization.json.JsonContentPolymorphicSerializer.deserialize(JsonContentPolymorphicSerializer.kt:94)
17:17:45.835 I at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
17:17:45.835 I at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
17:17:45.835 I at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
17:17:45.835 I at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:168)
17:17:45.835 I at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:538)
17:17:45.835 I at kotlinx.serialization.internal.CollectionLikeSerializer.readElement(CollectionSerializers.kt:80)
17:17:45.835 I at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
17:17:45.835 I at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
17:17:45.835 I at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
17:17:45.835 I at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
17:17:45.835 I at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
17:17:45.835 I at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
17:17:45.835 I at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:168)
17:17:45.835 I at com.google.ai.client.generativeai.common.shared.Content$$serializer.deserialize(Types.kt:46)
17:17:45.835 I at com.google.ai.client.generativeai.common.shared.Content$$serializer.deserialize(Types.kt:46)
17:17:45.835 I at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
17:17:45.836 I at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
17:17:45.836 I at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:78)
17:17:45.836 I at com.google.ai.client.generativeai.common.server.Candidate$$serializer.deserialize(Types.kt:51)
17:17:45.836 I at com.google.ai.client.generativeai.common.server.Candidate$$serializer.deserialize(Types.kt:51)
17:17:45.836 I at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
17:17:45.836 I at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
17:17:45.836 I at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
17:17:45.836 I at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:168)
17:17:45.836 I at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:538)
17:17:45.836 I at kotlinx.serialization.internal.CollectionLikeSerializer.readElement(CollectionSerializers.kt:80)
17:17:45.836 I at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
17:17:45.836 I at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
17:17:45.836 I at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
17:17:45.836 I at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
17:17:45.836 I at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
17:17:45.836 I at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:78)
17:17:45.836 I at com.google.ai.client.generativeai.common.GenerateContentResponse$$serializer.deserialize(Response.kt:26)
17:17:45.836 I at com.google.ai.client.generativeai.common.GenerateContentResponse$$serializer.deserialize(Response.kt:26)
17:17:45.836 I at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
17:17:45.836 I at kotlinx.serialization.json.Json.decodeFromString(Json.kt:165)
17:17:45.836 I at com.google.ai.client.generativeai.common.APIController$generateContentStream$$inlined$postStream$1$1$1$1$1.invokeSuspend(ktor.kt:103)
17:17:45.836 I at com.google.ai.client.generativeai.common.APIController$generateContentStream$$inlined$postStream$1$1$1$1$1.invoke(Unknown Source:8)
17:17:45.836 I at com.google.ai.client.generativeai.common.APIController$generateContentStream$$inlined$postStream$1$1$1$1$1.invoke(Unknown Source:4)
17:17:45.836 I at com.google.ai.client.generativeai.common.util.KtorKt.onEachLine(ktor.kt:52)
17:17:45.836 I at com.google.ai.client.generativeai.common.APIController$generateContentStream$$inlined$postStream$1$1$1$1.invokeSuspend(ktor.kt:82)
17:17:45.836 I at com.google.ai.client.generativeai.common.APIController$generateContentStream$$inlined$postStream$1$1$1$1.invoke(Unknown Source:8)
17:17:45.836 I at com.google.ai.client.generativeai.common.APIController$generateContentStream$$inlined$postStream$1$1$1$1.invoke(Unknown Source:4)
17:17:45.836 I at kotlinx.coroutines.flow.ChannelFlowBuilder.collectTo$suspendImpl(Builders.kt:316)
17:17:45.836 I at kotlinx.coroutines.flow.ChannelFlowBuilder.collectTo(Unknown Source:0)
17:17:45.836 I at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:56)
17:17:45.836 I at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
17:17:45.836 I at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
17:17:45.836 I ... 11 more
It looks like the json is valid but the deserialization fails anyway.
Steps to reproduce:
Call defineFunction with a boolean schema: Schema.bool("grewUpIn", "Whether the user grew up in this location or not.")
Wait for the LLM to call the function and fails.
The text was updated successfully, but these errors were encountered:
@niqo01 Thanks for the report! I've fixed this with #6033, and it should be live with the next release. The next release should be out by EOW next week (the 21st); baring any unforeseen circumstances. In the mean time, you can use a local artifact from the branch- which you can learn about here.
Per [b/346811894](https://b.corp.google.com/issues/346811894),
This fixes an issue with the VertexAI SDK failing to decode json
literals. More specifically, the fix was applied to
`generativeai:common` with `0.7.1`, and this PR bumps said dependency to
bring in the change.
Fixes#6028
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
I am declaring a function with
Schema.bool("grewUpIn", "Whether the user grew up in this location or not."),
and when Gemini call my function I get the following error:It looks like the json is valid but the deserialization fails anyway.
Steps to reproduce:
defineFunction
with a boolean schema:Schema.bool("grewUpIn", "Whether the user grew up in this location or not.")
The text was updated successfully, but these errors were encountered: