diff --git a/Google.GenAI/LiveConverters.cs b/Google.GenAI/LiveConverters.cs index b7c66e0c..440e3dac 100644 --- a/Google.GenAI/LiveConverters.cs +++ b/Google.GenAI/LiveConverters.cs @@ -31,6 +31,45 @@ public LiveConverters(ApiClient apiClient) { _apiClient = apiClient; } + internal JsonNode AuthConfigToMldev(JsonNode fromObject, JsonObject parentObject) { + JsonObject toObject = new JsonObject(); + + if (Common.GetValueByPath(fromObject, new string[] { "apiKey" }) != null) { + Common.SetValueByPath(toObject, new string[] { "apiKey" }, + Common.GetValueByPath(fromObject, new string[] { "apiKey" })); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "apiKeyConfig" }))) { + throw new NotSupportedException("apiKeyConfig parameter is not supported in Gemini API."); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "authType" }))) { + throw new NotSupportedException("authType parameter is not supported in Gemini API."); + } + + if (!Common.IsZero( + Common.GetValueByPath(fromObject, new string[] { "googleServiceAccountConfig" }))) { + throw new NotSupportedException( + "googleServiceAccountConfig parameter is not supported in Gemini API."); + } + + if (!Common.IsZero( + Common.GetValueByPath(fromObject, new string[] { "httpBasicAuthConfig" }))) { + throw new NotSupportedException( + "httpBasicAuthConfig parameter is not supported in Gemini API."); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "oauthConfig" }))) { + throw new NotSupportedException("oauthConfig parameter is not supported in Gemini API."); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "oidcConfig" }))) { + throw new NotSupportedException("oidcConfig parameter is not supported in Gemini API."); + } + + return toObject; + } + internal JsonNode BlobToMldev(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); @@ -72,6 +111,27 @@ internal JsonNode ContentToMldev(JsonNode fromObject, JsonObject parentObject) { return toObject; } + internal JsonNode ContentToVertex(JsonNode fromObject, JsonObject parentObject) { + JsonObject toObject = new JsonObject(); + + if (Common.GetValueByPath(fromObject, new string[] { "parts" }) != null) { + JsonArray keyArray = (JsonArray)Common.GetValueByPath(fromObject, new string[] { "parts" }); + JsonArray result = new JsonArray(); + + foreach (var record in keyArray) { + result.Add(PartToVertex(JsonNode.Parse(JsonSerializer.Serialize(record)), toObject)); + } + Common.SetValueByPath(toObject, new string[] { "parts" }, result); + } + + if (Common.GetValueByPath(fromObject, new string[] { "role" }) != null) { + Common.SetValueByPath(toObject, new string[] { "role" }, + Common.GetValueByPath(fromObject, new string[] { "role" })); + } + + return toObject; + } + internal JsonNode FileDataToMldev(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); @@ -106,35 +166,6 @@ internal JsonNode FileSearchToMldev(JsonNode fromObject, JsonObject parentObject return toObject; } - internal JsonNode FunctionCallToMldev(JsonNode fromObject, JsonObject parentObject) { - JsonObject toObject = new JsonObject(); - - if (Common.GetValueByPath(fromObject, new string[] { "id" }) != null) { - Common.SetValueByPath(toObject, new string[] { "id" }, - Common.GetValueByPath(fromObject, new string[] { "id" })); - } - - if (Common.GetValueByPath(fromObject, new string[] { "args" }) != null) { - Common.SetValueByPath(toObject, new string[] { "args" }, - Common.GetValueByPath(fromObject, new string[] { "args" })); - } - - if (Common.GetValueByPath(fromObject, new string[] { "name" }) != null) { - Common.SetValueByPath(toObject, new string[] { "name" }, - Common.GetValueByPath(fromObject, new string[] { "name" })); - } - - if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "partialArgs" }))) { - throw new NotSupportedException("partialArgs parameter is not supported in Gemini API."); - } - - if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "willContinue" }))) { - throw new NotSupportedException("willContinue parameter is not supported in Gemini API."); - } - - return toObject; - } - internal JsonNode FunctionDeclarationToVertex(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); @@ -271,11 +302,8 @@ internal JsonNode GenerationConfigToVertex(JsonNode fromObject, JsonObject paren } if (Common.GetValueByPath(fromObject, new string[] { "speechConfig" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "speechConfig" }, - SpeechConfigToVertex(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( - fromObject, new string[] { "speechConfig" }))), - toObject)); + Common.SetValueByPath(toObject, new string[] { "speechConfig" }, + Common.GetValueByPath(fromObject, new string[] { "speechConfig" })); } if (Common.GetValueByPath(fromObject, new string[] { "stopSequences" }) != null) { @@ -289,8 +317,11 @@ internal JsonNode GenerationConfigToVertex(JsonNode fromObject, JsonObject paren } if (Common.GetValueByPath(fromObject, new string[] { "thinkingConfig" }) != null) { - Common.SetValueByPath(toObject, new string[] { "thinkingConfig" }, - Common.GetValueByPath(fromObject, new string[] { "thinkingConfig" })); + Common.SetValueByPath( + toObject, new string[] { "thinkingConfig" }, + ThinkingConfigToVertex(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( + fromObject, new string[] { "thinkingConfig" }))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "topK" }) != null) { @@ -315,8 +346,12 @@ internal JsonNode GenerationConfigToVertex(JsonNode fromObject, JsonObject paren internal JsonNode GoogleMapsToMldev(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); - if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "authConfig" }))) { - throw new NotSupportedException("authConfig parameter is not supported in Gemini API."); + if (Common.GetValueByPath(fromObject, new string[] { "authConfig" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "authConfig" }, + AuthConfigToMldev(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( + fromObject, new string[] { "authConfig" }))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "enableWidget" }) != null) { @@ -330,16 +365,16 @@ internal JsonNode GoogleMapsToMldev(JsonNode fromObject, JsonObject parentObject internal JsonNode GoogleSearchToMldev(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); - if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "excludeDomains" }))) { - throw new NotSupportedException("excludeDomains parameter is not supported in Gemini API."); - } - if (!Common.IsZero( Common.GetValueByPath(fromObject, new string[] { "blockingConfidence" }))) { throw new NotSupportedException( "blockingConfidence parameter is not supported in Gemini API."); } + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "excludeDomains" }))) { + throw new NotSupportedException("excludeDomains parameter is not supported in Gemini API."); + } + if (Common.GetValueByPath(fromObject, new string[] { "timeRangeFilter" }) != null) { Common.SetValueByPath( toObject, new string[] { "timeRangeFilter" }, @@ -370,6 +405,27 @@ internal JsonNode LiveClientContentToMldev(JsonNode fromObject, JsonObject paren return toObject; } + internal JsonNode LiveClientContentToVertex(JsonNode fromObject, JsonObject parentObject) { + JsonObject toObject = new JsonObject(); + + if (Common.GetValueByPath(fromObject, new string[] { "turns" }) != null) { + JsonArray keyArray = (JsonArray)Common.GetValueByPath(fromObject, new string[] { "turns" }); + JsonArray result = new JsonArray(); + + foreach (var record in keyArray) { + result.Add(ContentToVertex(JsonNode.Parse(JsonSerializer.Serialize(record)), toObject)); + } + Common.SetValueByPath(toObject, new string[] { "turns" }, result); + } + + if (Common.GetValueByPath(fromObject, new string[] { "turnComplete" }) != null) { + Common.SetValueByPath(toObject, new string[] { "turnComplete" }, + Common.GetValueByPath(fromObject, new string[] { "turnComplete" })); + } + + return toObject; + } + internal JsonNode LiveClientMessageToMldev(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); @@ -425,8 +481,11 @@ internal JsonNode LiveClientMessageToVertex(JsonNode fromObject, JsonObject pare } if (Common.GetValueByPath(fromObject, new string[] { "clientContent" }) != null) { - Common.SetValueByPath(toObject, new string[] { "clientContent" }, - Common.GetValueByPath(fromObject, new string[] { "clientContent" })); + Common.SetValueByPath( + toObject, new string[] { "clientContent" }, + LiveClientContentToVertex(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( + fromObject, new string[] { "clientContent" }))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "realtimeInput" }) != null) { @@ -639,9 +698,12 @@ internal JsonNode LiveClientSetupToVertex(JsonNode fromObject, JsonObject parent } if (Common.GetValueByPath(fromObject, new string[] { "systemInstruction" }) != null) { - Common.SetValueByPath(toObject, new string[] { "systemInstruction" }, - Transformers.TContent(Common.GetValueByPath( - fromObject, new string[] { "systemInstruction" }))); + Common.SetValueByPath( + toObject, new string[] { "systemInstruction" }, + ContentToVertex( + JsonNode.Parse(JsonSerializer.Serialize(Transformers.TContent( + Common.GetValueByPath(fromObject, new string[] { "systemInstruction" })))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "tools" }) != null) { @@ -873,18 +935,18 @@ internal JsonNode LiveConnectConfigToVertex(JsonNode fromObject, JsonObject pare } if (Common.GetValueByPath(fromObject, new string[] { "speechConfig" }) != null) { - Common.SetValueByPath( - parentObject, new string[] { "setup", "generationConfig", "speechConfig" }, - SpeechConfigToVertex( - JsonNode.Parse(JsonSerializer.Serialize(Transformers.TLiveSpeechConfig( - Common.GetValueByPath(fromObject, new string[] { "speechConfig" })))), - toObject)); + Common.SetValueByPath(parentObject, + new string[] { "setup", "generationConfig", "speechConfig" }, + Transformers.TLiveSpeechConfig(Common.GetValueByPath( + fromObject, new string[] { "speechConfig" }))); } if (Common.GetValueByPath(fromObject, new string[] { "thinkingConfig" }) != null) { - Common.SetValueByPath(parentObject, - new string[] { "setup", "generationConfig", "thinkingConfig" }, - Common.GetValueByPath(fromObject, new string[] { "thinkingConfig" })); + Common.SetValueByPath( + parentObject, new string[] { "setup", "generationConfig", "thinkingConfig" }, + ThinkingConfigToVertex(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( + fromObject, new string[] { "thinkingConfig" }))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "enableAffectiveDialog" }) != null) { @@ -894,9 +956,12 @@ internal JsonNode LiveConnectConfigToVertex(JsonNode fromObject, JsonObject pare } if (Common.GetValueByPath(fromObject, new string[] { "systemInstruction" }) != null) { - Common.SetValueByPath(parentObject, new string[] { "setup", "systemInstruction" }, - Transformers.TContent(Common.GetValueByPath( - fromObject, new string[] { "systemInstruction" }))); + Common.SetValueByPath( + parentObject, new string[] { "setup", "systemInstruction" }, + ContentToVertex( + JsonNode.Parse(JsonSerializer.Serialize(Transformers.TContent( + Common.GetValueByPath(fromObject, new string[] { "systemInstruction" })))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "tools" }) != null) { @@ -1167,11 +1232,8 @@ internal JsonNode PartToMldev(JsonNode fromObject, JsonObject parentObject) { } if (Common.GetValueByPath(fromObject, new string[] { "functionCall" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "functionCall" }, - FunctionCallToMldev(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( - fromObject, new string[] { "functionCall" }))), - toObject)); + Common.SetValueByPath(toObject, new string[] { "functionCall" }, + Common.GetValueByPath(fromObject, new string[] { "functionCall" })); } if (Common.GetValueByPath(fromObject, new string[] { "functionResponse" }) != null) { @@ -1209,6 +1271,80 @@ internal JsonNode PartToMldev(JsonNode fromObject, JsonObject parentObject) { Common.GetValueByPath(fromObject, new string[] { "videoMetadata" })); } + if (Common.GetValueByPath(fromObject, new string[] { "partMetadata" }) != null) { + Common.SetValueByPath(toObject, new string[] { "partMetadata" }, + Common.GetValueByPath(fromObject, new string[] { "partMetadata" })); + } + + return toObject; + } + + internal JsonNode PartToVertex(JsonNode fromObject, JsonObject parentObject) { + JsonObject toObject = new JsonObject(); + + if (Common.GetValueByPath(fromObject, new string[] { "mediaResolution" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "mediaResolution" }, + Common.GetValueByPath(fromObject, new string[] { "mediaResolution" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "codeExecutionResult" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "codeExecutionResult" }, + Common.GetValueByPath(fromObject, new string[] { "codeExecutionResult" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "executableCode" }) != null) { + Common.SetValueByPath(toObject, new string[] { "executableCode" }, + Common.GetValueByPath(fromObject, new string[] { "executableCode" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "fileData" }) != null) { + Common.SetValueByPath(toObject, new string[] { "fileData" }, + Common.GetValueByPath(fromObject, new string[] { "fileData" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "functionCall" }) != null) { + Common.SetValueByPath(toObject, new string[] { "functionCall" }, + Common.GetValueByPath(fromObject, new string[] { "functionCall" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "functionResponse" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "functionResponse" }, + Common.GetValueByPath(fromObject, new string[] { "functionResponse" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "inlineData" }) != null) { + Common.SetValueByPath(toObject, new string[] { "inlineData" }, + Common.GetValueByPath(fromObject, new string[] { "inlineData" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "text" }) != null) { + Common.SetValueByPath(toObject, new string[] { "text" }, + Common.GetValueByPath(fromObject, new string[] { "text" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "thought" }) != null) { + Common.SetValueByPath(toObject, new string[] { "thought" }, + Common.GetValueByPath(fromObject, new string[] { "thought" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "thoughtSignature" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "thoughtSignature" }, + Common.GetValueByPath(fromObject, new string[] { "thoughtSignature" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "videoMetadata" }) != null) { + Common.SetValueByPath(toObject, new string[] { "videoMetadata" }, + Common.GetValueByPath(fromObject, new string[] { "videoMetadata" })); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "partMetadata" }))) { + throw new NotSupportedException("partMetadata parameter is not supported in Vertex AI."); + } + return toObject; } @@ -1227,23 +1363,22 @@ internal JsonNode SessionResumptionConfigToMldev(JsonNode fromObject, JsonObject return toObject; } - internal JsonNode SpeechConfigToVertex(JsonNode fromObject, JsonObject parentObject) { + internal JsonNode ThinkingConfigToVertex(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); - if (Common.GetValueByPath(fromObject, new string[] { "languageCode" }) != null) { - Common.SetValueByPath(toObject, new string[] { "languageCode" }, - Common.GetValueByPath(fromObject, new string[] { "languageCode" })); + if (Common.GetValueByPath(fromObject, new string[] { "includeThoughts" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "includeThoughts" }, + Common.GetValueByPath(fromObject, new string[] { "includeThoughts" })); } - if (Common.GetValueByPath(fromObject, new string[] { "voiceConfig" }) != null) { - Common.SetValueByPath(toObject, new string[] { "voiceConfig" }, - Common.GetValueByPath(fromObject, new string[] { "voiceConfig" })); + if (Common.GetValueByPath(fromObject, new string[] { "thinkingBudget" }) != null) { + Common.SetValueByPath(toObject, new string[] { "thinkingBudget" }, + Common.GetValueByPath(fromObject, new string[] { "thinkingBudget" })); } - if (!Common.IsZero( - Common.GetValueByPath(fromObject, new string[] { "multiSpeakerVoiceConfig" }))) { - throw new NotSupportedException( - "multiSpeakerVoiceConfig parameter is not supported in Vertex AI."); + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "thinkingLevel" }))) { + throw new NotSupportedException("thinkingLevel parameter is not supported in Vertex AI."); } return toObject; @@ -1273,6 +1408,14 @@ internal JsonNode ToolToMldev(JsonNode fromObject, JsonObject parentObject) { Common.GetValueByPath(fromObject, new string[] { "computerUse" })); } + if (Common.GetValueByPath(fromObject, new string[] { "googleMaps" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "googleMaps" }, + GoogleMapsToMldev(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( + fromObject, new string[] { "googleMaps" }))), + toObject)); + } + if (Common.GetValueByPath(fromObject, new string[] { "codeExecution" }) != null) { Common.SetValueByPath(toObject, new string[] { "codeExecution" }, Common.GetValueByPath(fromObject, new string[] { "codeExecution" })); @@ -1284,14 +1427,6 @@ internal JsonNode ToolToMldev(JsonNode fromObject, JsonObject parentObject) { "enterpriseWebSearch parameter is not supported in Gemini API."); } - if (Common.GetValueByPath(fromObject, new string[] { "googleMaps" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "googleMaps" }, - GoogleMapsToMldev(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( - fromObject, new string[] { "googleMaps" }))), - toObject)); - } - if (Common.GetValueByPath(fromObject, new string[] { "googleSearch" }) != null) { Common.SetValueByPath( toObject, new string[] { "googleSearch" }, @@ -1339,6 +1474,10 @@ internal JsonNode ToolToVertex(JsonNode fromObject, JsonObject parentObject) { Common.GetValueByPath(fromObject, new string[] { "computerUse" })); } + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "googleMaps" }))) { + throw new NotSupportedException("googleMaps parameter is not supported in Vertex AI."); + } + if (Common.GetValueByPath(fromObject, new string[] { "codeExecution" }) != null) { Common.SetValueByPath(toObject, new string[] { "codeExecution" }, Common.GetValueByPath(fromObject, new string[] { "codeExecution" })); @@ -1350,11 +1489,6 @@ internal JsonNode ToolToVertex(JsonNode fromObject, JsonObject parentObject) { Common.GetValueByPath(fromObject, new string[] { "enterpriseWebSearch" })); } - if (Common.GetValueByPath(fromObject, new string[] { "googleMaps" }) != null) { - Common.SetValueByPath(toObject, new string[] { "googleMaps" }, - Common.GetValueByPath(fromObject, new string[] { "googleMaps" })); - } - if (Common.GetValueByPath(fromObject, new string[] { "googleSearch" }) != null) { Common.SetValueByPath(toObject, new string[] { "googleSearch" }, Common.GetValueByPath(fromObject, new string[] { "googleSearch" })); diff --git a/Google.GenAI/Models.cs b/Google.GenAI/Models.cs index 13dd21b5..b3ddb47a 100644 --- a/Google.GenAI/Models.cs +++ b/Google.GenAI/Models.cs @@ -33,6 +33,45 @@ namespace Google.GenAI { public sealed class Models { private readonly ApiClient _apiClient; + internal JsonNode AuthConfigToMldev(JsonNode fromObject, JsonObject parentObject) { + JsonObject toObject = new JsonObject(); + + if (Common.GetValueByPath(fromObject, new string[] { "apiKey" }) != null) { + Common.SetValueByPath(toObject, new string[] { "apiKey" }, + Common.GetValueByPath(fromObject, new string[] { "apiKey" })); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "apiKeyConfig" }))) { + throw new NotSupportedException("apiKeyConfig parameter is not supported in Gemini API."); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "authType" }))) { + throw new NotSupportedException("authType parameter is not supported in Gemini API."); + } + + if (!Common.IsZero( + Common.GetValueByPath(fromObject, new string[] { "googleServiceAccountConfig" }))) { + throw new NotSupportedException( + "googleServiceAccountConfig parameter is not supported in Gemini API."); + } + + if (!Common.IsZero( + Common.GetValueByPath(fromObject, new string[] { "httpBasicAuthConfig" }))) { + throw new NotSupportedException( + "httpBasicAuthConfig parameter is not supported in Gemini API."); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "oauthConfig" }))) { + throw new NotSupportedException("oauthConfig parameter is not supported in Gemini API."); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "oidcConfig" }))) { + throw new NotSupportedException("oidcConfig parameter is not supported in Gemini API."); + } + + return toObject; + } + internal JsonNode BlobToMldev(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); @@ -79,17 +118,17 @@ internal JsonNode CandidateFromMldev(JsonNode fromObject, JsonObject parentObjec Common.GetValueByPath(fromObject, new string[] { "finishReason" })); } - if (Common.GetValueByPath(fromObject, new string[] { "avgLogprobs" }) != null) { - Common.SetValueByPath(toObject, new string[] { "avgLogprobs" }, - Common.GetValueByPath(fromObject, new string[] { "avgLogprobs" })); - } - if (Common.GetValueByPath(fromObject, new string[] { "groundingMetadata" }) != null) { Common.SetValueByPath( toObject, new string[] { "groundingMetadata" }, Common.GetValueByPath(fromObject, new string[] { "groundingMetadata" })); } + if (Common.GetValueByPath(fromObject, new string[] { "avgLogprobs" }) != null) { + Common.SetValueByPath(toObject, new string[] { "avgLogprobs" }, + Common.GetValueByPath(fromObject, new string[] { "avgLogprobs" })); + } + if (Common.GetValueByPath(fromObject, new string[] { "index" }) != null) { Common.SetValueByPath(toObject, new string[] { "index" }, Common.GetValueByPath(fromObject, new string[] { "index" })); @@ -138,9 +177,14 @@ internal JsonNode ComputeTokensParametersToVertex(ApiClient apiClient, JsonNode } if (Common.GetValueByPath(fromObject, new string[] { "contents" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "contents" }, - Transformers.TContents(Common.GetValueByPath(fromObject, new string[] { "contents" }))); + JsonArray keyArray = + (JsonArray)Common.GetValueByPath(fromObject, new string[] { "contents" }); + JsonArray result = new JsonArray(); + + foreach (var record in keyArray) { + result.Add(ContentToVertex(JsonNode.Parse(JsonSerializer.Serialize(record)), toObject)); + } + Common.SetValueByPath(toObject, new string[] { "contents" }, result); } return toObject; @@ -221,6 +265,27 @@ internal JsonNode ContentToMldev(JsonNode fromObject, JsonObject parentObject) { return toObject; } + internal JsonNode ContentToVertex(JsonNode fromObject, JsonObject parentObject) { + JsonObject toObject = new JsonObject(); + + if (Common.GetValueByPath(fromObject, new string[] { "parts" }) != null) { + JsonArray keyArray = (JsonArray)Common.GetValueByPath(fromObject, new string[] { "parts" }); + JsonArray result = new JsonArray(); + + foreach (var record in keyArray) { + result.Add(PartToVertex(JsonNode.Parse(JsonSerializer.Serialize(record)), toObject)); + } + Common.SetValueByPath(toObject, new string[] { "parts" }, result); + } + + if (Common.GetValueByPath(fromObject, new string[] { "role" }) != null) { + Common.SetValueByPath(toObject, new string[] { "role" }, + Common.GetValueByPath(fromObject, new string[] { "role" })); + } + + return toObject; + } + internal JsonNode ControlReferenceConfigToVertex(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); @@ -263,9 +328,12 @@ internal JsonNode CountTokensConfigToVertex(JsonNode fromObject, JsonObject pare JsonObject toObject = new JsonObject(); if (Common.GetValueByPath(fromObject, new string[] { "systemInstruction" }) != null) { - Common.SetValueByPath(parentObject, new string[] { "systemInstruction" }, - Transformers.TContent(Common.GetValueByPath( - fromObject, new string[] { "systemInstruction" }))); + Common.SetValueByPath( + parentObject, new string[] { "systemInstruction" }, + ContentToVertex( + JsonNode.Parse(JsonSerializer.Serialize(Transformers.TContent( + Common.GetValueByPath(fromObject, new string[] { "systemInstruction" })))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "tools" }) != null) { @@ -332,9 +400,14 @@ internal JsonNode CountTokensParametersToVertex(ApiClient apiClient, JsonNode fr } if (Common.GetValueByPath(fromObject, new string[] { "contents" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "contents" }, - Transformers.TContents(Common.GetValueByPath(fromObject, new string[] { "contents" }))); + JsonArray keyArray = + (JsonArray)Common.GetValueByPath(fromObject, new string[] { "contents" }); + JsonArray result = new JsonArray(); + + foreach (var record in keyArray) { + result.Add(ContentToVertex(JsonNode.Parse(JsonSerializer.Serialize(record)), toObject)); + } + Common.SetValueByPath(toObject, new string[] { "contents" }, result); } if (Common.GetValueByPath(fromObject, new string[] { "config" }) != null) { @@ -822,58 +895,6 @@ internal JsonNode FileSearchToMldev(JsonNode fromObject, JsonObject parentObject return toObject; } - internal JsonNode FunctionCallToMldev(JsonNode fromObject, JsonObject parentObject) { - JsonObject toObject = new JsonObject(); - - if (Common.GetValueByPath(fromObject, new string[] { "id" }) != null) { - Common.SetValueByPath(toObject, new string[] { "id" }, - Common.GetValueByPath(fromObject, new string[] { "id" })); - } - - if (Common.GetValueByPath(fromObject, new string[] { "args" }) != null) { - Common.SetValueByPath(toObject, new string[] { "args" }, - Common.GetValueByPath(fromObject, new string[] { "args" })); - } - - if (Common.GetValueByPath(fromObject, new string[] { "name" }) != null) { - Common.SetValueByPath(toObject, new string[] { "name" }, - Common.GetValueByPath(fromObject, new string[] { "name" })); - } - - if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "partialArgs" }))) { - throw new NotSupportedException("partialArgs parameter is not supported in Gemini API."); - } - - if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "willContinue" }))) { - throw new NotSupportedException("willContinue parameter is not supported in Gemini API."); - } - - return toObject; - } - - internal JsonNode FunctionCallingConfigToMldev(JsonNode fromObject, JsonObject parentObject) { - JsonObject toObject = new JsonObject(); - - if (Common.GetValueByPath(fromObject, new string[] { "mode" }) != null) { - Common.SetValueByPath(toObject, new string[] { "mode" }, - Common.GetValueByPath(fromObject, new string[] { "mode" })); - } - - if (Common.GetValueByPath(fromObject, new string[] { "allowedFunctionNames" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "allowedFunctionNames" }, - Common.GetValueByPath(fromObject, new string[] { "allowedFunctionNames" })); - } - - if (!Common.IsZero( - Common.GetValueByPath(fromObject, new string[] { "streamFunctionCallArguments" }))) { - throw new NotSupportedException( - "streamFunctionCallArguments parameter is not supported in Gemini API."); - } - - return toObject; - } - internal JsonNode FunctionDeclarationToVertex(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); @@ -1041,11 +1062,8 @@ internal JsonNode GenerateContentConfigToMldev(ApiClient apiClient, JsonNode fro } if (Common.GetValueByPath(fromObject, new string[] { "toolConfig" }) != null) { - Common.SetValueByPath( - parentObject, new string[] { "toolConfig" }, - ToolConfigToMldev(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( - fromObject, new string[] { "toolConfig" }))), - toObject)); + Common.SetValueByPath(parentObject, new string[] { "toolConfig" }, + Common.GetValueByPath(fromObject, new string[] { "toolConfig" })); } if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "labels" }))) { @@ -1103,9 +1121,12 @@ internal JsonNode GenerateContentConfigToVertex(ApiClient apiClient, JsonNode fr JsonObject toObject = new JsonObject(); if (Common.GetValueByPath(fromObject, new string[] { "systemInstruction" }) != null) { - Common.SetValueByPath(parentObject, new string[] { "systemInstruction" }, - Transformers.TContent(Common.GetValueByPath( - fromObject, new string[] { "systemInstruction" }))); + Common.SetValueByPath( + parentObject, new string[] { "systemInstruction" }, + ContentToVertex( + JsonNode.Parse(JsonSerializer.Serialize(Transformers.TContent( + Common.GetValueByPath(fromObject, new string[] { "systemInstruction" })))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "temperature" }) != null) { @@ -1244,12 +1265,9 @@ internal JsonNode GenerateContentConfigToVertex(ApiClient apiClient, JsonNode fr } if (Common.GetValueByPath(fromObject, new string[] { "speechConfig" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "speechConfig" }, - SpeechConfigToVertex( - JsonNode.Parse(JsonSerializer.Serialize(Transformers.TSpeechConfig( - Common.GetValueByPath(fromObject, new string[] { "speechConfig" })))), - toObject)); + Common.SetValueByPath(toObject, new string[] { "speechConfig" }, + Transformers.TSpeechConfig(Common.GetValueByPath( + fromObject, new string[] { "speechConfig" }))); } if (Common.GetValueByPath(fromObject, new string[] { "audioTimestamp" }) != null) { @@ -1258,8 +1276,11 @@ internal JsonNode GenerateContentConfigToVertex(ApiClient apiClient, JsonNode fr } if (Common.GetValueByPath(fromObject, new string[] { "thinkingConfig" }) != null) { - Common.SetValueByPath(toObject, new string[] { "thinkingConfig" }, - Common.GetValueByPath(fromObject, new string[] { "thinkingConfig" })); + Common.SetValueByPath( + toObject, new string[] { "thinkingConfig" }, + ThinkingConfigToVertex(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( + fromObject, new string[] { "thinkingConfig" }))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "imageConfig" }) != null) { @@ -1319,9 +1340,14 @@ internal JsonNode GenerateContentParametersToVertex(ApiClient apiClient, JsonNod } if (Common.GetValueByPath(fromObject, new string[] { "contents" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "contents" }, - Transformers.TContents(Common.GetValueByPath(fromObject, new string[] { "contents" }))); + JsonArray keyArray = + (JsonArray)Common.GetValueByPath(fromObject, new string[] { "contents" }); + JsonArray result = new JsonArray(); + + foreach (var record in keyArray) { + result.Add(ContentToVertex(JsonNode.Parse(JsonSerializer.Serialize(record)), toObject)); + } + Common.SetValueByPath(toObject, new string[] { "contents" }, result); } if (Common.GetValueByPath(fromObject, new string[] { "config" }) != null) { @@ -2419,11 +2445,8 @@ internal JsonNode GenerationConfigToVertex(JsonNode fromObject, JsonObject paren } if (Common.GetValueByPath(fromObject, new string[] { "speechConfig" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "speechConfig" }, - SpeechConfigToVertex(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( - fromObject, new string[] { "speechConfig" }))), - toObject)); + Common.SetValueByPath(toObject, new string[] { "speechConfig" }, + Common.GetValueByPath(fromObject, new string[] { "speechConfig" })); } if (Common.GetValueByPath(fromObject, new string[] { "stopSequences" }) != null) { @@ -2437,8 +2460,11 @@ internal JsonNode GenerationConfigToVertex(JsonNode fromObject, JsonObject paren } if (Common.GetValueByPath(fromObject, new string[] { "thinkingConfig" }) != null) { - Common.SetValueByPath(toObject, new string[] { "thinkingConfig" }, - Common.GetValueByPath(fromObject, new string[] { "thinkingConfig" })); + Common.SetValueByPath( + toObject, new string[] { "thinkingConfig" }, + ThinkingConfigToVertex(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( + fromObject, new string[] { "thinkingConfig" }))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "topK" }) != null) { @@ -2491,8 +2517,12 @@ internal JsonNode GetModelParametersToVertex(ApiClient apiClient, JsonNode fromO internal JsonNode GoogleMapsToMldev(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); - if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "authConfig" }))) { - throw new NotSupportedException("authConfig parameter is not supported in Gemini API."); + if (Common.GetValueByPath(fromObject, new string[] { "authConfig" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "authConfig" }, + AuthConfigToMldev(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( + fromObject, new string[] { "authConfig" }))), + toObject)); } if (Common.GetValueByPath(fromObject, new string[] { "enableWidget" }) != null) { @@ -2506,16 +2536,16 @@ internal JsonNode GoogleMapsToMldev(JsonNode fromObject, JsonObject parentObject internal JsonNode GoogleSearchToMldev(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); - if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "excludeDomains" }))) { - throw new NotSupportedException("excludeDomains parameter is not supported in Gemini API."); - } - if (!Common.IsZero( Common.GetValueByPath(fromObject, new string[] { "blockingConfidence" }))) { throw new NotSupportedException( "blockingConfidence parameter is not supported in Gemini API."); } + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "excludeDomains" }))) { + throw new NotSupportedException("excludeDomains parameter is not supported in Gemini API."); + } + if (Common.GetValueByPath(fromObject, new string[] { "timeRangeFilter" }) != null) { Common.SetValueByPath( toObject, new string[] { "timeRangeFilter" }, @@ -2548,6 +2578,17 @@ internal JsonNode ImageConfigToMldev(JsonNode fromObject, JsonObject parentObjec "outputCompressionQuality parameter is not supported in Gemini API."); } + if (!Common.IsZero( + Common.GetValueByPath(fromObject, new string[] { "imageOutputOptions" }))) { + throw new NotSupportedException( + "imageOutputOptions parameter is not supported in Gemini API."); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "personGeneration" }))) { + throw new NotSupportedException( + "personGeneration parameter is not supported in Gemini API."); + } + return toObject; } @@ -2575,6 +2616,18 @@ internal JsonNode ImageConfigToVertex(JsonNode fromObject, JsonObject parentObje Common.GetValueByPath(fromObject, new string[] { "outputCompressionQuality" })); } + if (Common.GetValueByPath(fromObject, new string[] { "imageOutputOptions" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "imageOutputOptions" }, + Common.GetValueByPath(fromObject, new string[] { "imageOutputOptions" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "personGeneration" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "personGeneration" }, + Common.GetValueByPath(fromObject, new string[] { "personGeneration" })); + } + return toObject; } @@ -2990,11 +3043,8 @@ internal JsonNode PartToMldev(JsonNode fromObject, JsonObject parentObject) { } if (Common.GetValueByPath(fromObject, new string[] { "functionCall" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "functionCall" }, - FunctionCallToMldev(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( - fromObject, new string[] { "functionCall" }))), - toObject)); + Common.SetValueByPath(toObject, new string[] { "functionCall" }, + Common.GetValueByPath(fromObject, new string[] { "functionCall" })); } if (Common.GetValueByPath(fromObject, new string[] { "functionResponse" }) != null) { @@ -3032,6 +3082,80 @@ internal JsonNode PartToMldev(JsonNode fromObject, JsonObject parentObject) { Common.GetValueByPath(fromObject, new string[] { "videoMetadata" })); } + if (Common.GetValueByPath(fromObject, new string[] { "partMetadata" }) != null) { + Common.SetValueByPath(toObject, new string[] { "partMetadata" }, + Common.GetValueByPath(fromObject, new string[] { "partMetadata" })); + } + + return toObject; + } + + internal JsonNode PartToVertex(JsonNode fromObject, JsonObject parentObject) { + JsonObject toObject = new JsonObject(); + + if (Common.GetValueByPath(fromObject, new string[] { "mediaResolution" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "mediaResolution" }, + Common.GetValueByPath(fromObject, new string[] { "mediaResolution" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "codeExecutionResult" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "codeExecutionResult" }, + Common.GetValueByPath(fromObject, new string[] { "codeExecutionResult" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "executableCode" }) != null) { + Common.SetValueByPath(toObject, new string[] { "executableCode" }, + Common.GetValueByPath(fromObject, new string[] { "executableCode" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "fileData" }) != null) { + Common.SetValueByPath(toObject, new string[] { "fileData" }, + Common.GetValueByPath(fromObject, new string[] { "fileData" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "functionCall" }) != null) { + Common.SetValueByPath(toObject, new string[] { "functionCall" }, + Common.GetValueByPath(fromObject, new string[] { "functionCall" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "functionResponse" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "functionResponse" }, + Common.GetValueByPath(fromObject, new string[] { "functionResponse" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "inlineData" }) != null) { + Common.SetValueByPath(toObject, new string[] { "inlineData" }, + Common.GetValueByPath(fromObject, new string[] { "inlineData" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "text" }) != null) { + Common.SetValueByPath(toObject, new string[] { "text" }, + Common.GetValueByPath(fromObject, new string[] { "text" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "thought" }) != null) { + Common.SetValueByPath(toObject, new string[] { "thought" }, + Common.GetValueByPath(fromObject, new string[] { "thought" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "thoughtSignature" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "thoughtSignature" }, + Common.GetValueByPath(fromObject, new string[] { "thoughtSignature" })); + } + + if (Common.GetValueByPath(fromObject, new string[] { "videoMetadata" }) != null) { + Common.SetValueByPath(toObject, new string[] { "videoMetadata" }, + Common.GetValueByPath(fromObject, new string[] { "videoMetadata" })); + } + + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "partMetadata" }))) { + throw new NotSupportedException("partMetadata parameter is not supported in Vertex AI."); + } + return toObject; } @@ -3440,43 +3564,22 @@ internal JsonNode SegmentImageSourceToVertex(JsonNode fromObject, JsonObject par return toObject; } - internal JsonNode SpeechConfigToVertex(JsonNode fromObject, JsonObject parentObject) { + internal JsonNode ThinkingConfigToVertex(JsonNode fromObject, JsonObject parentObject) { JsonObject toObject = new JsonObject(); - if (Common.GetValueByPath(fromObject, new string[] { "languageCode" }) != null) { - Common.SetValueByPath(toObject, new string[] { "languageCode" }, - Common.GetValueByPath(fromObject, new string[] { "languageCode" })); - } - - if (Common.GetValueByPath(fromObject, new string[] { "voiceConfig" }) != null) { - Common.SetValueByPath(toObject, new string[] { "voiceConfig" }, - Common.GetValueByPath(fromObject, new string[] { "voiceConfig" })); - } - - if (!Common.IsZero( - Common.GetValueByPath(fromObject, new string[] { "multiSpeakerVoiceConfig" }))) { - throw new NotSupportedException( - "multiSpeakerVoiceConfig parameter is not supported in Vertex AI."); + if (Common.GetValueByPath(fromObject, new string[] { "includeThoughts" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "includeThoughts" }, + Common.GetValueByPath(fromObject, new string[] { "includeThoughts" })); } - return toObject; - } - - internal JsonNode ToolConfigToMldev(JsonNode fromObject, JsonObject parentObject) { - JsonObject toObject = new JsonObject(); - - if (Common.GetValueByPath(fromObject, new string[] { "functionCallingConfig" }) != null) { - Common.SetValueByPath(toObject, new string[] { "functionCallingConfig" }, - FunctionCallingConfigToMldev( - JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( - fromObject, new string[] { "functionCallingConfig" }))), - toObject)); + if (Common.GetValueByPath(fromObject, new string[] { "thinkingBudget" }) != null) { + Common.SetValueByPath(toObject, new string[] { "thinkingBudget" }, + Common.GetValueByPath(fromObject, new string[] { "thinkingBudget" })); } - if (Common.GetValueByPath(fromObject, new string[] { "retrievalConfig" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "retrievalConfig" }, - Common.GetValueByPath(fromObject, new string[] { "retrievalConfig" })); + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "thinkingLevel" }))) { + throw new NotSupportedException("thinkingLevel parameter is not supported in Vertex AI."); } return toObject; @@ -3506,6 +3609,14 @@ internal JsonNode ToolToMldev(JsonNode fromObject, JsonObject parentObject) { Common.GetValueByPath(fromObject, new string[] { "computerUse" })); } + if (Common.GetValueByPath(fromObject, new string[] { "googleMaps" }) != null) { + Common.SetValueByPath( + toObject, new string[] { "googleMaps" }, + GoogleMapsToMldev(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( + fromObject, new string[] { "googleMaps" }))), + toObject)); + } + if (Common.GetValueByPath(fromObject, new string[] { "codeExecution" }) != null) { Common.SetValueByPath(toObject, new string[] { "codeExecution" }, Common.GetValueByPath(fromObject, new string[] { "codeExecution" })); @@ -3517,14 +3628,6 @@ internal JsonNode ToolToMldev(JsonNode fromObject, JsonObject parentObject) { "enterpriseWebSearch parameter is not supported in Gemini API."); } - if (Common.GetValueByPath(fromObject, new string[] { "googleMaps" }) != null) { - Common.SetValueByPath( - toObject, new string[] { "googleMaps" }, - GoogleMapsToMldev(JsonNode.Parse(JsonSerializer.Serialize(Common.GetValueByPath( - fromObject, new string[] { "googleMaps" }))), - toObject)); - } - if (Common.GetValueByPath(fromObject, new string[] { "googleSearch" }) != null) { Common.SetValueByPath( toObject, new string[] { "googleSearch" }, @@ -3572,6 +3675,10 @@ internal JsonNode ToolToVertex(JsonNode fromObject, JsonObject parentObject) { Common.GetValueByPath(fromObject, new string[] { "computerUse" })); } + if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "googleMaps" }))) { + throw new NotSupportedException("googleMaps parameter is not supported in Vertex AI."); + } + if (Common.GetValueByPath(fromObject, new string[] { "codeExecution" }) != null) { Common.SetValueByPath(toObject, new string[] { "codeExecution" }, Common.GetValueByPath(fromObject, new string[] { "codeExecution" })); @@ -3583,11 +3690,6 @@ internal JsonNode ToolToVertex(JsonNode fromObject, JsonObject parentObject) { Common.GetValueByPath(fromObject, new string[] { "enterpriseWebSearch" })); } - if (Common.GetValueByPath(fromObject, new string[] { "googleMaps" }) != null) { - Common.SetValueByPath(toObject, new string[] { "googleMaps" }, - Common.GetValueByPath(fromObject, new string[] { "googleMaps" })); - } - if (Common.GetValueByPath(fromObject, new string[] { "googleSearch" }) != null) { Common.SetValueByPath(toObject, new string[] { "googleSearch" }, Common.GetValueByPath(fromObject, new string[] { "googleSearch" })); diff --git a/Google.GenAI/types/Blob.cs b/Google.GenAI/types/Blob.cs index 3dbeca21..6ad82514 100644 --- a/Google.GenAI/types/Blob.cs +++ b/Google.GenAI/types/Blob.cs @@ -23,22 +23,23 @@ namespace Google.GenAI.Types { /// - /// Content blob. + /// A content blob. A Blob contains data of a specific media type. It is used to represent images, + /// audio, and video. /// public record Blob { /// - /// Raw bytes. + /// The raw bytes of the data. /// [JsonPropertyName("data")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public byte[] ? Data { get; set; } /// - /// Optional. Display name of the blob. Used to provide a label or filename to distinguish - /// blobs. This field is only returned in PromptMessage for prompt management. It is currently - /// used in the Gemini GenerateContent calls only when server side tools (code_execution, - /// google_search, and url_context) are enabled. This field is not supported in Gemini API. + /// Optional. The display name of the blob. Used to provide a label or filename to distinguish + /// blobs. This field is only returned in `PromptMessage` for prompt management. It is used in + /// the Gemini calls only when server-side tools (`code_execution`, `google_search`, and + /// `url_context`) are enabled. This field is not supported in Gemini API. /// [JsonPropertyName("displayName")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/Candidate.cs b/Google.GenAI/types/Candidate.cs index 117b788e..ac2d4d5a 100644 --- a/Google.GenAI/types/Candidate.cs +++ b/Google.GenAI/types/Candidate.cs @@ -76,27 +76,31 @@ public FinishReason } /// - /// Output only. Average log probability score of the candidate. + /// Output only. Grounding metadata for the candidate. This field is populated for + /// `GenerateContent` calls. /// - [JsonPropertyName("avgLogprobs")] + [JsonPropertyName("groundingMetadata")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public double - ? AvgLogprobs { + public GroundingMetadata + ? GroundingMetadata { get; set; } /// - /// Output only. Metadata specifies sources used to ground generated content. + /// Output only. The average log probability of the tokens in this candidate. This is a + /// length-normalized score that can be used to compare the quality of candidates of different + /// lengths. A higher average log probability suggests a more confident and coherent response. /// - [JsonPropertyName("groundingMetadata")] + [JsonPropertyName("avgLogprobs")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public GroundingMetadata - ? GroundingMetadata { + public double + ? AvgLogprobs { get; set; } /// - /// Output only. Index of the candidate. + /// Output only. The 0-based index of this candidate in the list of generated responses. This is + /// useful for distinguishing between multiple candidates when `candidate_count` > 1. /// [JsonPropertyName("index")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -106,7 +110,9 @@ public int } /// - /// Output only. Log-likelihood scores for the response tokens and top tokens + /// Output only. The detailed log probability information for the tokens in this candidate. This + /// is useful for debugging, understanding model uncertainty, and identifying potential + /// "hallucinations". /// [JsonPropertyName("logprobsResult")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -116,7 +122,7 @@ public LogprobsResult } /// - /// Output only. List of ratings for the safety of a response candidate. There is at most one + /// Output only. A list of ratings for the safety of a response candidate. There is at most one /// rating per category. /// [JsonPropertyName("safetyRatings")] @@ -127,7 +133,8 @@ public List } /// - /// Output only. Metadata related to url context retrieval tool. + /// Output only. Metadata returned when the model uses the `url_context` tool to get information + /// from a user-provided URL. /// [JsonPropertyName("urlContextMetadata")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/Citation.cs b/Google.GenAI/types/Citation.cs index 1dccd108..311e285d 100644 --- a/Google.GenAI/types/Citation.cs +++ b/Google.GenAI/types/Citation.cs @@ -23,19 +23,19 @@ namespace Google.GenAI.Types { /// - /// Source attributions for content. This data type is not supported in Gemini API. + /// A citation for a piece of generatedcontent. This data type is not supported in Gemini API. /// public record Citation { /// - /// Output only. End index into the content. + /// Output only. The end index of the citation in the content. /// [JsonPropertyName("endIndex")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public int ? EndIndex { get; set; } /// - /// Output only. License of the attribution. + /// Output only. The license of the source of the citation. /// [JsonPropertyName("license")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -45,7 +45,7 @@ public string } /// - /// Output only. Publication date of the attribution. + /// Output only. The publication date of the source of the citation. /// [JsonPropertyName("publicationDate")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -55,7 +55,7 @@ public GoogleTypeDate } /// - /// Output only. Start index into the content. + /// Output only. The start index of the citation in the content. /// [JsonPropertyName("startIndex")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -65,7 +65,7 @@ public int } /// - /// Output only. Title of the attribution. + /// Output only. The title of the source of the citation. /// [JsonPropertyName("title")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -75,7 +75,7 @@ public string } /// - /// Output only. Url reference of the attribution. + /// Output only. The URI of the source of the citation. /// [JsonPropertyName("uri")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/Content.cs b/Google.GenAI/types/Content.cs index a87c946a..6d2b841d 100644 --- a/Google.GenAI/types/Content.cs +++ b/Google.GenAI/types/Content.cs @@ -36,8 +36,8 @@ public record Content { public List ? Parts { get; set; } /// - /// Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for - /// multi-turn conversations, otherwise can be left blank or unset. + /// Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the + /// service will default to 'user'. /// [JsonPropertyName("role")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/EnterpriseWebSearch.cs b/Google.GenAI/types/EnterpriseWebSearch.cs index af1c9f6b..8e2a81bd 100644 --- a/Google.GenAI/types/EnterpriseWebSearch.cs +++ b/Google.GenAI/types/EnterpriseWebSearch.cs @@ -29,21 +29,21 @@ namespace Google.GenAI.Types { public record EnterpriseWebSearch { /// - /// Optional. List of domains to be excluded from the search results. The default limit is 2000 - /// domains. + /// Optional. Sites with confidence level chosen & above this value will be blocked from the + /// search results. /// - [JsonPropertyName("excludeDomains")] + [JsonPropertyName("blockingConfidence")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public List ? ExcludeDomains { get; set; } + public PhishBlockThreshold ? BlockingConfidence { get; set; } /// - /// Optional. Sites with confidence level chosen & above this value will be blocked from the - /// search results. + /// Optional. List of domains to be excluded from the search results. The default limit is 2000 + /// domains. /// - [JsonPropertyName("blockingConfidence")] + [JsonPropertyName("excludeDomains")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public PhishBlockThreshold - ? BlockingConfidence { + public List + ? ExcludeDomains { get; set; } diff --git a/Google.GenAI/types/FileData.cs b/Google.GenAI/types/FileData.cs index 5a8d938a..93156e2d 100644 --- a/Google.GenAI/types/FileData.cs +++ b/Google.GenAI/types/FileData.cs @@ -23,23 +23,23 @@ namespace Google.GenAI.Types { /// - /// URI based data. + /// URI-based data. A FileData message contains a URI pointing to data of a specific media type. + /// It is used to represent images, audio, and video stored in Google Cloud Storage. /// public record FileData { /// - /// Optional. Display name of the file data. Used to provide a label or filename to distinguish - /// file datas. This field is only returned in PromptMessage for prompt management. It is - /// currently used in the Gemini GenerateContent calls only when server side tools - /// (code_execution, google_search, and url_context) are enabled. This field is not supported in - /// Gemini API. + /// Optional. The display name of the file. Used to provide a label or filename to distinguish + /// files. This field is only returned in `PromptMessage` for prompt management. It is used in + /// the Gemini calls only when server side tools (`code_execution`, `google_search`, and + /// `url_context`) are enabled. This field is not supported in Gemini API. /// [JsonPropertyName("displayName")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string ? DisplayName { get; set; } /// - /// URI. + /// The URI of the file in Google Cloud Storage. /// [JsonPropertyName("fileUri")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/FileSearch.cs b/Google.GenAI/types/FileSearch.cs new file mode 100644 index 00000000..e6d256a8 --- /dev/null +++ b/Google.GenAI/types/FileSearch.cs @@ -0,0 +1,75 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using Google.GenAI.Serialization; + +namespace Google.GenAI.Types { + /// + /// The FileSearch tool that retrieves knowledge from Semantic Retrieval corpora. Files are + /// imported to Semantic Retrieval corpora using the ImportFile API. This data type is not + /// supported in Vertex AI. + /// + + public record FileSearch { + /// + /// The names of the file_search_stores to retrieve from. Example: + /// `fileSearchStores/my-file-search-store-123` + /// + [JsonPropertyName("fileSearchStoreNames")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public List ? FileSearchStoreNames { get; set; } + + /// + /// Optional. Metadata filter to apply to the semantic retrieval documents and chunks. + /// + [JsonPropertyName("metadataFilter")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string + ? MetadataFilter { + get; set; + } + + /// + /// Optional. The number of semantic retrieval chunks to retrieve. + /// + [JsonPropertyName("topK")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int + ? TopK { + get; set; + } + + /// + /// Deserializes a JSON string to a FileSearch object. + /// + /// The JSON string to deserialize. + /// Optional JsonSerializerOptions. + /// The deserialized FileSearch object, or null if deserialization fails. + public static FileSearch ? FromJson(string jsonString, JsonSerializerOptions? options = null) { + try { + return JsonSerializer.Deserialize(jsonString, options); + } catch (JsonException e) { + Console.Error.WriteLine($"Error deserializing JSON: {e.ToString()}"); + return null; + } + } + } +} diff --git a/Google.GenAI/types/GenerationConfig.cs b/Google.GenAI/types/GenerationConfig.cs index d5544804..26a51c58 100644 --- a/Google.GenAI/types/GenerationConfig.cs +++ b/Google.GenAI/types/GenerationConfig.cs @@ -46,8 +46,9 @@ public object } /// - /// Optional. If enabled, audio timestamp will be included in the request to the model. This - /// field is not supported in Gemini API. + /// Optional. If enabled, audio timestamps will be included in the request to the model. This + /// can be useful for synchronizing audio with other modalities in the response. This field is + /// not supported in Gemini API. /// [JsonPropertyName("audioTimestamp")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -57,7 +58,9 @@ public bool } /// - /// Optional. Number of candidates to generate. + /// Optional. The number of candidate responses to generate. A higher `candidate_count` can + /// provide more options to choose from, but it also consumes more resources. This can be useful + /// for generating a variety of responses and selecting the best one. /// [JsonPropertyName("candidateCount")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -68,7 +71,8 @@ public int /// /// Optional. If enabled, the model will detect emotions and adapt its responses accordingly. - /// This field is not supported in Gemini API. + /// For example, if the model detects that the user is frustrated, it may provide a more + /// empathetic response. This field is not supported in Gemini API. /// [JsonPropertyName("enableAffectiveDialog")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -78,7 +82,9 @@ public bool } /// - /// Optional. Frequency penalties. + /// Optional. Penalizes tokens based on their frequency in the generated text. A positive value + /// helps to reduce the repetition of words and phrases. Valid values can range from + /// [-2.0, 2.0]. /// [JsonPropertyName("frequencyPenalty")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -88,7 +94,9 @@ public double } /// - /// Optional. Logit probabilities. + /// Optional. The number of top log probabilities to return for each token. This can be used to + /// see which other tokens were considered likely candidates for a given position. A higher + /// value will return more options, but it will also increase the size of the response. /// [JsonPropertyName("logprobs")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -98,7 +106,9 @@ public int } /// - /// Optional. The maximum number of output tokens to generate per message. + /// Optional. The maximum number of tokens to generate in the response. A token is approximately + /// four characters. The default value varies by model. This parameter can be used to control + /// the length of the generated text and prevent overly long responses. /// [JsonPropertyName("maxOutputTokens")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -108,7 +118,11 @@ public int } /// - /// Optional. If specified, the media resolution specified will be used. + /// Optional. The token resolution at which input media content is sampled. This is used to + /// control the trade-off between the quality of the response and the number of tokens used to + /// represent the media. A higher resolution allows the model to perceive more detail, which can + /// lead to a more nuanced response, but it will also use more tokens. This does not affect the + /// image dimensions sent to the model. /// [JsonPropertyName("mediaResolution")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -118,7 +132,9 @@ public MediaResolution } /// - /// Optional. Positive penalties. + /// Optional. Penalizes tokens that have already appeared in the generated text. A positive + /// value encourages the model to generate more diverse and less repetitive text. Valid values + /// can range from [-2.0, 2.0]. /// [JsonPropertyName("presencePenalty")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -128,7 +144,10 @@ public double } /// - /// Optional. If true, export the logprobs results in response. + /// Optional. If set to true, the log probabilities of the output tokens are returned. Log + /// probabilities are the logarithm of the probability of a token appearing in the output. A + /// higher log probability means the token is more likely to be generated. This can be useful + /// for analyzing the model's confidence in its own output and for debugging. /// [JsonPropertyName("responseLogprobs")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -138,10 +157,10 @@ public bool } /// - /// Optional. Output response mimetype of the generated candidate text. Supported mimetype: - - /// `text/plain`: (default) Text output. - `application/json`: JSON response in the candidates. - /// The model needs to be prompted to output the appropriate response type, otherwise the - /// behavior is undefined. This is a preview feature. + /// Optional. The IANA standard MIME type of the response. The model will generate output that + /// conforms to this MIME type. Supported values include 'text/plain' (default) and + /// 'application/json'. The model needs to be prompted to output the appropriate response type, + /// otherwise the behavior is undefined. This is a preview feature. /// [JsonPropertyName("responseMimeType")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -151,7 +170,9 @@ public string } /// - /// Optional. The modalities of the response. + /// Optional. The modalities of the response. The model will generate a response that includes + /// all the specified modalities. For example, if this is set to `[TEXT, IMAGE]`, the response + /// will include both text and an image. /// [JsonPropertyName("responseModalities")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -161,11 +182,11 @@ public List } /// - /// Optional. The `Schema` object allows the definition of input and output data types. These - /// types can be objects, but also primitives and arrays. Represents a select subset of an - /// OpenAPI 3.0 schema object (https://spec.openapis.org/oas/v3.0.3#schema). If set, a - /// compatible response_mime_type must also be set. Compatible mimetypes: `application/json`: - /// Schema for JSON response. + /// Optional. Lets you to specify a schema for the model's response, ensuring that the output + /// conforms to a particular structure. This is useful for generating structured data such as + /// JSON. The schema is a subset of the OpenAPI 3.0 schema object + /// (https://spec.openapis.org/oas/v3.0.3#schema) object. When this field is set, you must also + /// set the `response_mime_type` to `application/json`. /// [JsonPropertyName("responseSchema")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -185,7 +206,13 @@ public GenerationConfigRoutingConfig } /// - /// Optional. Seed. + /// Optional. A seed for the random number generator. By setting a seed, you can make the + /// model's output mostly deterministic. For a given prompt and parameters (like temperature, + /// top_p, etc.), the model will produce the same response every time. However, it's not a + /// guaranteed absolute deterministic behavior. This is different from parameters like + /// `temperature`, which control the *level* of randomness. `seed` ensures that the "random" + /// choices the model makes are the same on every run, making it essential for testing and + /// ensuring reproducible results. /// [JsonPropertyName("seed")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -205,7 +232,10 @@ public SpeechConfig } /// - /// Optional. Stop sequences. + /// Optional. A list of character sequences that will stop the model from generating further + /// tokens. If a stop sequence is generated, the output will end at that point. This is useful + /// for controlling the length and structure of the output. For example, you can use ["\n", + /// "###"] to stop generation at a new line or a specific marker. /// [JsonPropertyName("stopSequences")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -215,7 +245,9 @@ public List } /// - /// Optional. Controls the randomness of predictions. + /// Optional. Controls the randomness of the output. A higher temperature results in more + /// creative and diverse responses, while a lower temperature makes the output more predictable + /// and focused. The valid range is (0.0, 2.0]. /// [JsonPropertyName("temperature")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -225,8 +257,8 @@ public double } /// - /// Optional. Config for thinking features. An error will be returned if this field is set for - /// models that don't support thinking. + /// Optional. Configuration for thinking features. An error will be returned if this field is + /// set for models that don't support thinking. /// [JsonPropertyName("thinkingConfig")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -236,7 +268,10 @@ public ThinkingConfig } /// - /// Optional. If specified, top-k sampling will be used. + /// Optional. Specifies the top-k sampling threshold. The model considers only the top k most + /// probable tokens for the next token. This can be useful for generating more coherent and less + /// random text. For example, a `top_k` of 40 means the model will choose the next word from the + /// 40 most likely words. /// [JsonPropertyName("topK")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -246,7 +281,11 @@ public double } /// - /// Optional. If specified, nucleus sampling will be used. + /// Optional. Specifies the nucleus sampling threshold. The model considers only the smallest + /// set of tokens whose cumulative probability is at least `top_p`. This helps generate more + /// diverse and less repetitive responses. For example, a `top_p` of 0.9 means the model + /// considers tokens until the cumulative probability of the tokens to select from reaches 0.9. + /// It's recommended to adjust either temperature or `top_p`, but not both. /// [JsonPropertyName("topP")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/GenerationConfigRoutingConfig.cs b/Google.GenAI/types/GenerationConfigRoutingConfig.cs index 2f453dcf..6484c7cb 100644 --- a/Google.GenAI/types/GenerationConfigRoutingConfig.cs +++ b/Google.GenAI/types/GenerationConfigRoutingConfig.cs @@ -23,20 +23,21 @@ namespace Google.GenAI.Types { /// - /// The configuration for routing the request to a specific model. This data type is not supported - /// in Gemini API. + /// The configuration for routing the request to a specific model. This can be used to control + /// which model is used for the generation, either automatically or by specifying a model name. + /// This data type is not supported in Gemini API. /// public record GenerationConfigRoutingConfig { /// - /// Automated routing. + /// In this mode, the model is selected automatically based on the content of the request. /// [JsonPropertyName("autoMode")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public GenerationConfigRoutingConfigAutoRoutingMode ? AutoMode { get; set; } /// - /// Manual routing. + /// In this mode, the model is specified manually. /// [JsonPropertyName("manualMode")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/GenerationConfigRoutingConfigAutoRoutingMode.cs b/Google.GenAI/types/GenerationConfigRoutingConfigAutoRoutingMode.cs index b6199cde..f6f58b2b 100644 --- a/Google.GenAI/types/GenerationConfigRoutingConfigAutoRoutingMode.cs +++ b/Google.GenAI/types/GenerationConfigRoutingConfigAutoRoutingMode.cs @@ -23,9 +23,9 @@ namespace Google.GenAI.Types { /// - /// When automated routing is specified, the routing will be determined by the pretrained routing - /// model and customer provided model routing preference. This data type is not supported in - /// Gemini API. + /// The configuration for automated routing. When automated routing is specified, the routing will + /// be determined by the pretrained routing model and customer provided model routing preference. + /// This data type is not supported in Gemini API. /// public record GenerationConfigRoutingConfigAutoRoutingMode { diff --git a/Google.GenAI/types/GenerationConfigRoutingConfigManualRoutingMode.cs b/Google.GenAI/types/GenerationConfigRoutingConfigManualRoutingMode.cs index 3bbc2e70..b36a73b5 100644 --- a/Google.GenAI/types/GenerationConfigRoutingConfigManualRoutingMode.cs +++ b/Google.GenAI/types/GenerationConfigRoutingConfigManualRoutingMode.cs @@ -23,14 +23,13 @@ namespace Google.GenAI.Types { /// - /// When manual routing is set, the specified model will be used directly. This data type is not - /// supported in Gemini API. + /// The configuration for manual routing. When manual routing is specified, the model will be + /// selected based on the model name provided. This data type is not supported in Gemini API. /// public record GenerationConfigRoutingConfigManualRoutingMode { /// - /// The model name to use. Only the public LLM models are accepted. See Supported models - /// (https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models). + /// The name of the model to use. Only public LLM models are accepted. /// [JsonPropertyName("modelName")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/GoogleMaps.cs b/Google.GenAI/types/GoogleMaps.cs index f34be064..c3202ec9 100644 --- a/Google.GenAI/types/GoogleMaps.cs +++ b/Google.GenAI/types/GoogleMaps.cs @@ -23,7 +23,7 @@ namespace Google.GenAI.Types { /// - /// Tool to retrieve public maps data for grounding, powered by Google. + /// Tool to retrieve knowledge from Google Maps. /// public record GoogleMaps { @@ -36,7 +36,9 @@ public record GoogleMaps { public AuthConfig ? AuthConfig { get; set; } /// - /// Optional. If true, include the widget context token in the response. + /// Optional. Whether to return a widget context token in the GroundingMetadata of the response. + /// Developers can use the widget context token to render a Google Maps widget with geospatial + /// context related to the places that the model references in the response. /// [JsonPropertyName("enableWidget")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/GoogleSearch.cs b/Google.GenAI/types/GoogleSearch.cs index a163f4bf..2586fbcf 100644 --- a/Google.GenAI/types/GoogleSearch.cs +++ b/Google.GenAI/types/GoogleSearch.cs @@ -28,21 +28,21 @@ namespace Google.GenAI.Types { public record GoogleSearch { /// - /// Optional. List of domains to be excluded from the search results. The default limit is 2000 - /// domains. Example: ["amazon.com", "facebook.com"]. This field is not supported in Gemini API. + /// Optional. Sites with confidence level chosen & above this value will be blocked from the + /// search results. This field is not supported in Gemini API. /// - [JsonPropertyName("excludeDomains")] + [JsonPropertyName("blockingConfidence")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public List ? ExcludeDomains { get; set; } + public PhishBlockThreshold ? BlockingConfidence { get; set; } /// - /// Optional. Sites with confidence level chosen & above this value will be blocked from the - /// search results. This field is not supported in Gemini API. + /// Optional. List of domains to be excluded from the search results. The default limit is 2000 + /// domains. Example: ["amazon.com", "facebook.com"]. This field is not supported in Gemini API. /// - [JsonPropertyName("blockingConfidence")] + [JsonPropertyName("excludeDomains")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public PhishBlockThreshold - ? BlockingConfidence { + public List + ? ExcludeDomains { get; set; } diff --git a/Google.GenAI/types/GroundingChunk.cs b/Google.GenAI/types/GroundingChunk.cs index e8b9a456..c48ea9da 100644 --- a/Google.GenAI/types/GroundingChunk.cs +++ b/Google.GenAI/types/GroundingChunk.cs @@ -23,20 +23,22 @@ namespace Google.GenAI.Types { /// - /// Grounding chunk. + /// A chunk of evidence that was used to generate the response. /// public record GroundingChunk { /// - /// Grounding chunk from Google Maps. This field is not supported in Gemini API. + /// A `Maps` chunk is a piece of evidence that comes from Google Maps. It contains information + /// about a place, such as its name, address, and reviews. This is used to provide the user with + /// rich, location-based information. /// [JsonPropertyName("maps")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public GroundingChunkMaps ? Maps { get; set; } /// - /// Grounding chunk from context retrieved by the retrieval tools. This field is not supported - /// in Gemini API. + /// A grounding chunk from a data source retrieved by a retrieval tool, such as Vertex AI + /// Search. See the `RetrievedContext` message for details /// [JsonPropertyName("retrievedContext")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -46,7 +48,8 @@ public GroundingChunkRetrievedContext } /// - /// Grounding chunk from the web. + /// A grounding chunk from a web page, typically from Google Search. See the `Web` message for + /// details. /// [JsonPropertyName("web")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/GroundingChunkMaps.cs b/Google.GenAI/types/GroundingChunkMaps.cs index bf4df52f..001cba73 100644 --- a/Google.GenAI/types/GroundingChunkMaps.cs +++ b/Google.GenAI/types/GroundingChunkMaps.cs @@ -23,20 +23,23 @@ namespace Google.GenAI.Types { /// - /// Chunk from Google Maps. This data type is not supported in Gemini API. + /// A `Maps` chunk is a piece of evidence that comes from Google Maps. It contains information + /// about a place, such as its name, address, and reviews. This is used to provide the user with + /// rich, location-based information. /// public record GroundingChunkMaps { /// - /// Sources used to generate the place answer. This includes review snippets and photos that - /// were used to generate the answer, as well as uris to flag content. + /// The sources that were used to generate the place answer. This includes review snippets and + /// photos that were used to generate the answer, as well as URIs to flag content. /// [JsonPropertyName("placeAnswerSources")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public GroundingChunkMapsPlaceAnswerSources ? PlaceAnswerSources { get; set; } /// - /// This Place's resource name, in `places/{place_id}` format. Can be used to look up the Place. + /// This Place's resource name, in `places/{place_id}` format. This can be used to look up the + /// place in the Google Maps API. /// [JsonPropertyName("placeId")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -46,7 +49,7 @@ public string } /// - /// Text of the place answer. + /// The text of the place answer. /// [JsonPropertyName("text")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -56,7 +59,7 @@ public string } /// - /// Title of the place. + /// The title of the place. /// [JsonPropertyName("title")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -66,7 +69,7 @@ public string } /// - /// URI reference of the place. + /// The URI of the place. /// [JsonPropertyName("uri")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/GroundingChunkMapsPlaceAnswerSources.cs b/Google.GenAI/types/GroundingChunkMapsPlaceAnswerSources.cs index e4da31df..edc97f4b 100644 --- a/Google.GenAI/types/GroundingChunkMapsPlaceAnswerSources.cs +++ b/Google.GenAI/types/GroundingChunkMapsPlaceAnswerSources.cs @@ -23,19 +23,30 @@ namespace Google.GenAI.Types { /// - /// Sources used to generate the place answer. This data type is not supported in Gemini API. + /// The sources that were used to generate the place answer. This includes review snippets and + /// photos that were used to generate the answer, as well as URIs to flag content. /// public record GroundingChunkMapsPlaceAnswerSources { + /// + /// Snippets of reviews that were used to generate the answer. + /// + [JsonPropertyName("reviewSnippet")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public List ? ReviewSnippet { get; set; } + /// /// A link where users can flag a problem with the generated answer. /// [JsonPropertyName("flagContentUri")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string ? FlagContentUri { get; set; } + public string + ? FlagContentUri { + get; set; + } /// - /// Snippets of reviews that are used to generate the answer. + /// Snippets of reviews that were used to generate the answer. /// [JsonPropertyName("reviewSnippets")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.cs b/Google.GenAI/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.cs index 53305e1b..b4fbbd0d 100644 --- a/Google.GenAI/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.cs +++ b/Google.GenAI/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.cs @@ -23,7 +23,7 @@ namespace Google.GenAI.Types { /// - /// Encapsulates a review snippet. This data type is not supported in Gemini API. + /// Encapsulates a review snippet. /// public record GroundingChunkMapsPlaceAnswerSourcesReviewSnippet { diff --git a/Google.GenAI/types/GroundingChunkRetrievedContext.cs b/Google.GenAI/types/GroundingChunkRetrievedContext.cs index 4285907f..15e43d6b 100644 --- a/Google.GenAI/types/GroundingChunkRetrievedContext.cs +++ b/Google.GenAI/types/GroundingChunkRetrievedContext.cs @@ -23,21 +23,25 @@ namespace Google.GenAI.Types { /// - /// Chunk from context retrieved by the retrieval tools. This data type is not supported in Gemini - /// API. + /// Context retrieved from a data source to ground the model's response. This is used when a + /// retrieval tool fetches information from a user-provided corpus or a public dataset. /// public record GroundingChunkRetrievedContext { /// - /// Output only. The full document name for the referenced Vertex AI Search document. + /// Output only. The full resource name of the referenced Vertex AI Search document. This is + /// used to identify the specific document that was retrieved. The format is + /// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. + /// This field is not supported in Gemini API. /// [JsonPropertyName("documentName")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string ? DocumentName { get; set; } /// - /// Additional context for the RAG retrieval result. This is only populated when using the RAG - /// retrieval tool. + /// Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. This is + /// populated only when the RAG retrieval tool is used. This field is not supported in Gemini + /// API. /// [JsonPropertyName("ragChunk")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -47,7 +51,7 @@ public RagChunk } /// - /// Text of the attribution. + /// The content of the retrieved data source. /// [JsonPropertyName("text")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -57,7 +61,7 @@ public string } /// - /// Title of the attribution. + /// The title of the retrieved data source. /// [JsonPropertyName("title")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -67,7 +71,7 @@ public string } /// - /// URI reference of the attribution. + /// The URI of the retrieved data source. /// [JsonPropertyName("uri")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -76,6 +80,17 @@ public string get; set; } + /// + /// Optional. Name of the `FileSearchStore` containing the document. Example: + /// `fileSearchStores/123`. This field is not supported in Vertex AI. + /// + [JsonPropertyName("fileSearchStore")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string + ? FileSearchStore { + get; set; + } + /// /// Deserializes a JSON string to a GroundingChunkRetrievedContext object. /// diff --git a/Google.GenAI/types/GroundingChunkWeb.cs b/Google.GenAI/types/GroundingChunkWeb.cs index b26c8618..19b24b3e 100644 --- a/Google.GenAI/types/GroundingChunkWeb.cs +++ b/Google.GenAI/types/GroundingChunkWeb.cs @@ -23,19 +23,22 @@ namespace Google.GenAI.Types { /// - /// Chunk from the web. + /// A `Web` chunk is a piece of evidence that comes from a web page. It contains the URI of the + /// web page, the title of the page, and the domain of the page. This is used to provide the user + /// with a link to the source of the information. /// public record GroundingChunkWeb { /// - /// Domain of the (original) URI. This field is not supported in Gemini API. + /// The domain of the web page that contains the evidence. This can be used to filter out + /// low-quality sources. This field is not supported in Gemini API. /// [JsonPropertyName("domain")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string ? Domain { get; set; } /// - /// Title of the chunk. + /// The title of the web page that contains the evidence. /// [JsonPropertyName("title")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -45,7 +48,7 @@ public string } /// - /// URI reference of the chunk. + /// The URI of the web page that contains the evidence. /// [JsonPropertyName("uri")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/GroundingMetadata.cs b/Google.GenAI/types/GroundingMetadata.cs index 6e198e0e..e10d3503 100644 --- a/Google.GenAI/types/GroundingMetadata.cs +++ b/Google.GenAI/types/GroundingMetadata.cs @@ -27,27 +27,15 @@ namespace Google.GenAI.Types { /// public record GroundingMetadata { - /// - /// Optional. Output only. Resource name of the Google Maps widget context token to be used with - /// the PlacesContextElement widget to render contextual data. This is populated only for Google - /// Maps grounding. This field is not supported in Gemini API. - /// - [JsonPropertyName("googleMapsWidgetContextToken")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string ? GoogleMapsWidgetContextToken { get; set; } - /// /// List of supporting references retrieved from specified grounding source. /// [JsonPropertyName("groundingChunks")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public List - ? GroundingChunks { - get; set; - } + public List ? GroundingChunks { get; set; } /// - /// Optional. List of grounding support. + /// List of grounding support. /// [JsonPropertyName("groundingSupports")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -57,7 +45,7 @@ public List } /// - /// Optional. Output only. Retrieval metadata. + /// Metadata related to retrieval in the grounding flow. /// [JsonPropertyName("retrievalMetadata")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -67,44 +55,57 @@ public RetrievalMetadata } /// - /// Optional. Queries executed by the retrieval tools. This field is not supported in Gemini - /// API. + /// Optional. Google search entry for the following-up web searches. /// - [JsonPropertyName("retrievalQueries")] + [JsonPropertyName("searchEntryPoint")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public List - ? RetrievalQueries { + public SearchEntryPoint + ? SearchEntryPoint { get; set; } /// - /// Optional. Google search entry for the following-up web searches. + /// Web search queries for the following-up web search. /// - [JsonPropertyName("searchEntryPoint")] + [JsonPropertyName("webSearchQueries")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public SearchEntryPoint - ? SearchEntryPoint { + public List + ? WebSearchQueries { get; set; } /// - /// Optional. Output only. List of source flagging uris. This is currently populated only for - /// Google Maps grounding. This field is not supported in Gemini API. + /// Optional. Output only. A token that can be used to render a Google Maps widget with the + /// contextual data. This field is populated only when the grounding source is Google Maps. /// - [JsonPropertyName("sourceFlaggingUris")] + [JsonPropertyName("googleMapsWidgetContextToken")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public List - ? SourceFlaggingUris { + public string + ? GoogleMapsWidgetContextToken { get; set; } /// - /// Optional. Web search queries for the following-up web search. + /// Optional. The queries that were executed by the retrieval tools. This field is populated + /// only when the grounding source is a retrieval tool, such as Vertex AI Search. This field is + /// not supported in Gemini API. /// - [JsonPropertyName("webSearchQueries")] + [JsonPropertyName("retrievalQueries")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public List - ? WebSearchQueries { + ? RetrievalQueries { + get; set; + } + + /// + /// Optional. Output only. A list of URIs that can be used to flag a place or review for + /// inappropriate content. This field is populated only when the grounding source is Google + /// Maps. This field is not supported in Gemini API. + /// + [JsonPropertyName("sourceFlaggingUris")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public List + ? SourceFlaggingUris { get; set; } diff --git a/Google.GenAI/types/GroundingMetadataSourceFlaggingUri.cs b/Google.GenAI/types/GroundingMetadataSourceFlaggingUri.cs index db26e760..a861fa47 100644 --- a/Google.GenAI/types/GroundingMetadataSourceFlaggingUri.cs +++ b/Google.GenAI/types/GroundingMetadataSourceFlaggingUri.cs @@ -23,20 +23,20 @@ namespace Google.GenAI.Types { /// - /// Source content flagging uri for a place or review. This is currently populated only for Google - /// Maps grounding. This data type is not supported in Gemini API. + /// A URI that can be used to flag a place or review for inappropriate content. This is populated + /// only when the grounding source is Google Maps. This data type is not supported in Gemini API. /// public record GroundingMetadataSourceFlaggingUri { /// - /// A link where users can flag a problem with the source (place or review). + /// The URI that can be used to flag the content. /// [JsonPropertyName("flagContentUri")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string ? FlagContentUri { get; set; } /// - /// Id of the place or review. + /// The ID of the place or review. /// [JsonPropertyName("sourceId")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/GroundingSupport.cs b/Google.GenAI/types/GroundingSupport.cs index f556ec23..8abbe430 100644 --- a/Google.GenAI/types/GroundingSupport.cs +++ b/Google.GenAI/types/GroundingSupport.cs @@ -28,9 +28,8 @@ namespace Google.GenAI.Types { public record GroundingSupport { /// - /// Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. For - /// Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For - /// Gemini 2.5 and after, this list will be empty and should be ignored. + /// Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. + /// This list must have the same size as the grounding_chunk_indices. /// [JsonPropertyName("confidenceScores")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/HarmBlockMethod.cs b/Google.GenAI/types/HarmBlockMethod.cs index c55aa25f..27b48697 100644 --- a/Google.GenAI/types/HarmBlockMethod.cs +++ b/Google.GenAI/types/HarmBlockMethod.cs @@ -20,8 +20,8 @@ namespace Google.GenAI.Types { /// - /// Specify if the threshold is used for probability or severity score. If not specified, the - /// threshold is used for probability score. This enum is not supported in Gemini API. + /// The method for blocking content. If not specified, the default behavior is to use the + /// probability score. This enum is not supported in Gemini API. /// [JsonConverter(typeof(JsonStringEnumConverter))] public enum HarmBlockMethod { diff --git a/Google.GenAI/types/HarmBlockThreshold.cs b/Google.GenAI/types/HarmBlockThreshold.cs index e9016d6b..cfaae238 100644 --- a/Google.GenAI/types/HarmBlockThreshold.cs +++ b/Google.GenAI/types/HarmBlockThreshold.cs @@ -20,37 +20,38 @@ namespace Google.GenAI.Types { /// - /// The harm block threshold. + /// The threshold for blocking content. If the harm probability exceeds this threshold, the + /// content will be blocked. /// [JsonConverter(typeof(JsonStringEnumConverter))] public enum HarmBlockThreshold { /// - /// Unspecified harm block threshold. + /// The harm block threshold is unspecified. /// [JsonPropertyName("HARM_BLOCK_THRESHOLD_UNSPECIFIED")] HARM_BLOCK_THRESHOLD_UNSPECIFIED, /// - /// Block low threshold and above (i.e. block more). + /// Block content with a low harm probability or higher. /// [JsonPropertyName("BLOCK_LOW_AND_ABOVE")] BLOCK_LOW_AND_ABOVE, /// - /// Block medium threshold and above. + /// Block content with a medium harm probability or higher. /// [JsonPropertyName("BLOCK_MEDIUM_AND_ABOVE")] BLOCK_MEDIUM_AND_ABOVE, /// - /// Block only high threshold (i.e. block less). + /// Block content with a high harm probability. /// [JsonPropertyName("BLOCK_ONLY_HIGH")] BLOCK_ONLY_HIGH, /// - /// Block none. + /// Do not block any content, regardless of its harm probability. /// [JsonPropertyName("BLOCK_NONE")] BLOCK_NONE, /// - /// Turn off the safety filter. + /// Turn off the safety filter entirely. /// [JsonPropertyName("OFF")] OFF } diff --git a/Google.GenAI/types/HarmCategory.cs b/Google.GenAI/types/HarmCategory.cs index 9d5f97b5..79d3bcdc 100644 --- a/Google.GenAI/types/HarmCategory.cs +++ b/Google.GenAI/types/HarmCategory.cs @@ -20,32 +20,33 @@ namespace Google.GenAI.Types { /// - /// Harm category. + /// The harm category to be blocked. /// [JsonConverter(typeof(JsonStringEnumConverter))] public enum HarmCategory { /// - /// The harm category is unspecified. + /// Default value. This value is unused. /// [JsonPropertyName("HARM_CATEGORY_UNSPECIFIED")] HARM_CATEGORY_UNSPECIFIED, /// - /// The harm category is harassment. + /// Abusive, threatening, or content intended to bully, torment, or ridicule. /// [JsonPropertyName("HARM_CATEGORY_HARASSMENT")] HARM_CATEGORY_HARASSMENT, /// - /// The harm category is hate speech. + /// Content that promotes violence or incites hatred against individuals or groups based on + /// certain attributes. /// [JsonPropertyName("HARM_CATEGORY_HATE_SPEECH")] HARM_CATEGORY_HATE_SPEECH, /// - /// The harm category is sexually explicit content. + /// Content that contains sexually explicit material. /// [JsonPropertyName("HARM_CATEGORY_SEXUALLY_EXPLICIT")] HARM_CATEGORY_SEXUALLY_EXPLICIT, /// - /// The harm category is dangerous content. + /// Content that promotes, facilitates, or enables dangerous activities. /// [JsonPropertyName("HARM_CATEGORY_DANGEROUS_CONTENT")] HARM_CATEGORY_DANGEROUS_CONTENT, @@ -55,31 +56,30 @@ public enum HarmCategory { [JsonPropertyName("HARM_CATEGORY_CIVIC_INTEGRITY")] HARM_CATEGORY_CIVIC_INTEGRITY, /// - /// The harm category is image hate. This enum value is not supported in Gemini API. + /// Images that contain hate speech. This enum value is not supported in Gemini API. /// [JsonPropertyName("HARM_CATEGORY_IMAGE_HATE")] HARM_CATEGORY_IMAGE_HATE, /// - /// The harm category is image dangerous content. This enum value is not supported in Gemini - /// API. + /// Images that contain dangerous content. This enum value is not supported in Gemini API. /// [JsonPropertyName( "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT")] HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT, /// - /// The harm category is image harassment. This enum value is not supported in Gemini API. + /// Images that contain harassment. This enum value is not supported in Gemini API. /// [JsonPropertyName("HARM_CATEGORY_IMAGE_HARASSMENT")] HARM_CATEGORY_IMAGE_HARASSMENT, /// - /// The harm category is image sexually explicit content. This enum value is not supported in - /// Gemini API. + /// Images that contain sexually explicit content. This enum value is not supported in Gemini + /// API. /// [JsonPropertyName( "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT")] HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT, /// - /// The harm category is for jailbreak prompts. This enum value is not supported in Gemini API. + /// Prompts designed to bypass safety filters. This enum value is not supported in Gemini API. /// [JsonPropertyName("HARM_CATEGORY_JAILBREAK")] HARM_CATEGORY_JAILBREAK } diff --git a/Google.GenAI/types/HarmProbability.cs b/Google.GenAI/types/HarmProbability.cs index a8a28e38..f1c5a341 100644 --- a/Google.GenAI/types/HarmProbability.cs +++ b/Google.GenAI/types/HarmProbability.cs @@ -20,32 +20,32 @@ namespace Google.GenAI.Types { /// - /// Output only. Harm probability levels in the content. + /// Output only. The probability of harm for this category. /// [JsonConverter(typeof(JsonStringEnumConverter))] public enum HarmProbability { /// - /// Harm probability unspecified. + /// The harm probability is unspecified. /// [JsonPropertyName("HARM_PROBABILITY_UNSPECIFIED")] HARM_PROBABILITY_UNSPECIFIED, /// - /// Negligible level of harm. + /// The harm probability is negligible. /// [JsonPropertyName("NEGLIGIBLE")] NEGLIGIBLE, /// - /// Low level of harm. + /// The harm probability is low. /// [JsonPropertyName("LOW")] LOW, /// - /// Medium level of harm. + /// The harm probability is medium. /// [JsonPropertyName("MEDIUM")] MEDIUM, /// - /// High level of harm. + /// The harm probability is high. /// [JsonPropertyName("HIGH")] HIGH } diff --git a/Google.GenAI/types/HarmSeverity.cs b/Google.GenAI/types/HarmSeverity.cs index 275091ae..7491e6e6 100644 --- a/Google.GenAI/types/HarmSeverity.cs +++ b/Google.GenAI/types/HarmSeverity.cs @@ -20,32 +20,32 @@ namespace Google.GenAI.Types { /// - /// Output only. Harm severity levels in the content. This enum is not supported in Gemini API. + /// Output only. The severity of harm for this category. This enum is not supported in Gemini API. /// [JsonConverter(typeof(JsonStringEnumConverter))] public enum HarmSeverity { /// - /// Harm severity unspecified. + /// The harm severity is unspecified. /// [JsonPropertyName("HARM_SEVERITY_UNSPECIFIED")] HARM_SEVERITY_UNSPECIFIED, /// - /// Negligible level of harm severity. + /// The harm severity is negligible. /// [JsonPropertyName("HARM_SEVERITY_NEGLIGIBLE")] HARM_SEVERITY_NEGLIGIBLE, /// - /// Low level of harm severity. + /// The harm severity is low. /// [JsonPropertyName("HARM_SEVERITY_LOW")] HARM_SEVERITY_LOW, /// - /// Medium level of harm severity. + /// The harm severity is medium. /// [JsonPropertyName("HARM_SEVERITY_MEDIUM")] HARM_SEVERITY_MEDIUM, /// - /// High level of harm severity. + /// The harm severity is high. /// [JsonPropertyName("HARM_SEVERITY_HIGH")] HARM_SEVERITY_HIGH } diff --git a/Google.GenAI/types/ImageConfig.cs b/Google.GenAI/types/ImageConfig.cs index b9607006..af7d34ab 100644 --- a/Google.GenAI/types/ImageConfig.cs +++ b/Google.GenAI/types/ImageConfig.cs @@ -67,6 +67,28 @@ public int get; set; } + /// + /// Optional. The image output format for generated images. This field is not supported in + /// Gemini API. + /// + [JsonPropertyName("imageOutputOptions")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public ImageConfigImageOutputOptions + ? ImageOutputOptions { + get; set; + } + + /// + /// Optional. Controls whether the model can generate people. This field is not supported in + /// Gemini API. + /// + [JsonPropertyName("personGeneration")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public PersonGeneration + ? PersonGeneration { + get; set; + } + /// /// Deserializes a JSON string to a ImageConfig object. /// diff --git a/Google.GenAI/types/ImageConfigImageOutputOptions.cs b/Google.GenAI/types/ImageConfigImageOutputOptions.cs new file mode 100644 index 00000000..b9cafec0 --- /dev/null +++ b/Google.GenAI/types/ImageConfigImageOutputOptions.cs @@ -0,0 +1,64 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using Google.GenAI.Serialization; + +namespace Google.GenAI.Types { + /// + /// The image output format for generated images. This data type is not supported in Gemini API. + /// + + public record ImageConfigImageOutputOptions { + /// + /// Optional. The compression quality of the output image. + /// + [JsonPropertyName("compressionQuality")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int ? CompressionQuality { get; set; } + + /// + /// Optional. The image format that the output should be saved as. + /// + [JsonPropertyName("mimeType")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string + ? MimeType { + get; set; + } + + /// + /// Deserializes a JSON string to a ImageConfigImageOutputOptions object. + /// + /// The JSON string to deserialize. + /// Optional JsonSerializerOptions. + /// The deserialized ImageConfigImageOutputOptions object, or null if deserialization + /// fails. + public static ImageConfigImageOutputOptions + ? FromJson(string jsonString, JsonSerializerOptions? options = null) { + try { + return JsonSerializer.Deserialize(jsonString, options); + } catch (JsonException e) { + Console.Error.WriteLine($"Error deserializing JSON: {e.ToString()}"); + return null; + } + } + } +} diff --git a/Google.GenAI/types/InlinedEmbedContentResponse.cs b/Google.GenAI/types/InlinedEmbedContentResponse.cs index 1b5c1f47..c8972239 100644 --- a/Google.GenAI/types/InlinedEmbedContentResponse.cs +++ b/Google.GenAI/types/InlinedEmbedContentResponse.cs @@ -44,6 +44,16 @@ public JobError get; set; } + /// + /// Output only. The metadata associated with the request. + /// + [JsonPropertyName("metadata")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public Dictionary + ? Metadata { + get; set; + } + /// /// Deserializes a JSON string to a InlinedEmbedContentResponse object. /// diff --git a/Google.GenAI/types/LogprobsResult.cs b/Google.GenAI/types/LogprobsResult.cs index a6161f0b..1f449144 100644 --- a/Google.GenAI/types/LogprobsResult.cs +++ b/Google.GenAI/types/LogprobsResult.cs @@ -23,20 +23,26 @@ namespace Google.GenAI.Types { /// - /// Logprobs Result + /// The log probabilities of the tokens generated by the model. This is useful for understanding + /// the model's confidence in its predictions and for debugging. For example, you can use log + /// probabilities to identify when the model is making a less confident prediction or to explore + /// alternative responses that the model considered. A low log probability can also indicate that + /// the model is "hallucinating" or generating factually incorrect information. /// public record LogprobsResult { /// - /// Length = total number of decoding steps. The chosen candidates may or may not be in - /// top_candidates. + /// A list of the chosen candidate tokens at each decoding step. The length of this list is + /// equal to the total number of decoding steps. Note that the chosen candidate might not be in + /// `top_candidates`. /// [JsonPropertyName("chosenCandidates")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public List ? ChosenCandidates { get; set; } /// - /// Length = total number of decoding steps. + /// A list of the top candidate tokens at each decoding step. The length of this list is equal + /// to the total number of decoding steps. /// [JsonPropertyName("topCandidates")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -45,6 +51,16 @@ public List get; set; } + /// + /// Sum of log probabilities for all tokens. This field is not supported in Vertex AI. + /// + [JsonPropertyName("logProbabilitySum")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public double + ? LogProbabilitySum { + get; set; + } + /// /// Deserializes a JSON string to a LogprobsResult object. /// diff --git a/Google.GenAI/types/LogprobsResultCandidate.cs b/Google.GenAI/types/LogprobsResultCandidate.cs index 09f4c665..858f055a 100644 --- a/Google.GenAI/types/LogprobsResultCandidate.cs +++ b/Google.GenAI/types/LogprobsResultCandidate.cs @@ -23,19 +23,21 @@ namespace Google.GenAI.Types { /// - /// Candidate for the logprobs token and score. + /// A single token and its associated log probability. /// public record LogprobsResultCandidate { /// - /// The candidate's log probability. + /// The log probability of this token. A higher value indicates that the model was more + /// confident in this token. The log probability can be used to assess the relative likelihood + /// of different tokens and to identify when the model is uncertain. /// [JsonPropertyName("logProbability")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public double ? LogProbability { get; set; } /// - /// The candidate's token string value. + /// The token's string representation. /// [JsonPropertyName("token")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -45,7 +47,9 @@ public string } /// - /// The candidate's token id value. + /// The token's numerical ID. While the `token` field provides the string representation of the + /// token, the `token_id` is the numerical representation that the model uses internally. This + /// can be useful for developers who want to build custom logic based on the model's vocabulary. /// [JsonPropertyName("tokenId")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/LogprobsResultTopCandidates.cs b/Google.GenAI/types/LogprobsResultTopCandidates.cs index a74eb166..ae4e5f02 100644 --- a/Google.GenAI/types/LogprobsResultTopCandidates.cs +++ b/Google.GenAI/types/LogprobsResultTopCandidates.cs @@ -23,12 +23,13 @@ namespace Google.GenAI.Types { /// - /// Candidates with top log probabilities at each decoding step. + /// A list of the top candidate tokens and their log probabilities at each decoding step. This can + /// be used to see what other tokens the model considered. /// public record LogprobsResultTopCandidates { /// - /// Sorted by log probability in descending order. + /// The list of candidate tokens, sorted by log probability in descending order. /// [JsonPropertyName("candidates")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/ModalityTokenCount.cs b/Google.GenAI/types/ModalityTokenCount.cs index 2c372f8d..a0afb4f7 100644 --- a/Google.GenAI/types/ModalityTokenCount.cs +++ b/Google.GenAI/types/ModalityTokenCount.cs @@ -35,7 +35,7 @@ public record ModalityTokenCount { public MediaModality ? Modality { get; set; } /// - /// Number of tokens. + /// The number of tokens counted for this modality. /// [JsonPropertyName("tokenCount")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/MultiSpeakerVoiceConfig.cs b/Google.GenAI/types/MultiSpeakerVoiceConfig.cs index b68dfd20..6ff829f0 100644 --- a/Google.GenAI/types/MultiSpeakerVoiceConfig.cs +++ b/Google.GenAI/types/MultiSpeakerVoiceConfig.cs @@ -23,12 +23,13 @@ namespace Google.GenAI.Types { /// - /// The configuration for the multi-speaker setup. This data type is not supported in Vertex AI. + /// Configuration for a multi-speaker text-to-speech request. /// public record MultiSpeakerVoiceConfig { /// - /// All the enabled speaker voices. + /// A list of configurations for the voices of the speakers. Exactly two speaker voice + /// configurations must be provided. /// [JsonPropertyName("speakerVoiceConfigs")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/Part.cs b/Google.GenAI/types/Part.cs index 00cf0e30..961be713 100644 --- a/Google.GenAI/types/Part.cs +++ b/Google.GenAI/types/Part.cs @@ -37,7 +37,7 @@ public record Part { public PartMediaResolution ? MediaResolution { get; set; } /// - /// Optional. Result of executing the [ExecutableCode]. + /// Optional. The result of executing the ExecutableCode. /// [JsonPropertyName("codeExecutionResult")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -47,7 +47,7 @@ public CodeExecutionResult } /// - /// Optional. Code generated by the model that is meant to be executed. + /// Optional. Code generated by the model that is intended to be executed. /// [JsonPropertyName("executableCode")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -57,7 +57,8 @@ public ExecutableCode } /// - /// Optional. URI based data. + /// Optional. The URI-based data of the part. This can be used to include files from Google + /// Cloud Storage. /// [JsonPropertyName("fileData")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -67,8 +68,8 @@ public FileData } /// - /// Optional. A predicted [FunctionCall] returned from the model that contains a string - /// representing the [FunctionDeclaration.name] with the parameters and their values. + /// Optional. A predicted function call returned from the model. This contains the name of the + /// function to call and the arguments to pass to the function. /// [JsonPropertyName("functionCall")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -78,9 +79,8 @@ public FunctionCall } /// - /// Optional. The result output of a [FunctionCall] that contains a string representing the - /// [FunctionDeclaration.name] and a structured JSON object containing any output from the - /// function call. It is used as context to the model. + /// Optional. The result of a function call. This is used to provide the model with the result + /// of a function call that it predicted. /// [JsonPropertyName("functionResponse")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -90,7 +90,8 @@ public FunctionResponse } /// - /// Optional. Inlined bytes data. + /// Optional. The inline data content of the part. This can be used to include images, audio, or + /// video in a request. /// [JsonPropertyName("inlineData")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -100,7 +101,7 @@ public Blob } /// - /// Optional. Text part (can be code). + /// Optional. The text content of the part. /// [JsonPropertyName("text")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -110,7 +111,7 @@ public string } /// - /// Optional. Indicates if the part is thought from the model. + /// Optional. Indicates whether the `part` represents the model's thought process or reasoning. /// [JsonPropertyName("thought")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -140,6 +141,19 @@ public VideoMetadata get; set; } + /// + /// Custom metadata associated with the Part. Agents using genai.Part as content representation + /// may need to keep track of the additional information. For example it can be name of a + /// file/source from which the Part originates or a way to multiplex multiple Part streams. This + /// field is not supported in Vertex AI. + /// + [JsonPropertyName("partMetadata")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public Dictionary + ? PartMetadata { + get; set; + } + /// /// Deserializes a JSON string to a Part object. /// diff --git a/Google.GenAI/types/PrebuiltVoiceConfig.cs b/Google.GenAI/types/PrebuiltVoiceConfig.cs index 69a2284f..efea66fd 100644 --- a/Google.GenAI/types/PrebuiltVoiceConfig.cs +++ b/Google.GenAI/types/PrebuiltVoiceConfig.cs @@ -23,12 +23,12 @@ namespace Google.GenAI.Types { /// - /// The configuration for the prebuilt speaker to use. + /// Configuration for a prebuilt voice. /// public record PrebuiltVoiceConfig { /// - /// The name of the preset voice to use. + /// The name of the prebuilt voice to use. /// [JsonPropertyName("voiceName")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/RetrievalMetadata.cs b/Google.GenAI/types/RetrievalMetadata.cs index 3e376d21..4e38ff24 100644 --- a/Google.GenAI/types/RetrievalMetadata.cs +++ b/Google.GenAI/types/RetrievalMetadata.cs @@ -23,15 +23,15 @@ namespace Google.GenAI.Types { /// - /// Metadata related to retrieval in the grounding flow. + /// Metadata returned to client when grounding is enabled. /// public record RetrievalMetadata { /// - /// Optional. Score indicating how likely information from Google Search could help answer the - /// prompt. The score is in the range `[0, 1]`, where 0 is the least likely and 1 is the most - /// likely. This score is only populated when Google Search grounding and dynamic retrieval is - /// enabled. It will be compared to the threshold to determine whether to trigger Google Search. + /// Optional. Score indicating how likely information from google search could help answer the + /// prompt. The score is in the range [0, 1], where 0 is the least likely and 1 is the most + /// likely. This score is only populated when google search grounding and dynamic retrieval is + /// enabled. It will be compared to the threshold to determine whether to trigger google search. /// [JsonPropertyName("googleSearchDynamicRetrievalScore")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/SafetyRating.cs b/Google.GenAI/types/SafetyRating.cs index 89fe39b9..d0335509 100644 --- a/Google.GenAI/types/SafetyRating.cs +++ b/Google.GenAI/types/SafetyRating.cs @@ -23,19 +23,20 @@ namespace Google.GenAI.Types { /// - /// Safety rating corresponding to the generated content. + /// A safety rating for a piece of content. The safety rating contains the harm category and the + /// harm probability level. /// public record SafetyRating { /// - /// Output only. Indicates whether the content was filtered out because of this rating. + /// Output only. Indicates whether the content was blocked because of this rating. /// [JsonPropertyName("blocked")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public bool ? Blocked { get; set; } /// - /// Output only. Harm category. + /// Output only. The harm category of this rating. /// [JsonPropertyName("category")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -57,7 +58,7 @@ public HarmBlockThreshold } /// - /// Output only. Harm probability levels in the content. + /// Output only. The probability of harm for this category. /// [JsonPropertyName("probability")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -67,7 +68,8 @@ public HarmProbability } /// - /// Output only. Harm probability score. This field is not supported in Gemini API. + /// Output only. The probability score of harm for this category. This field is not supported in + /// Gemini API. /// [JsonPropertyName("probabilityScore")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -77,7 +79,8 @@ public double } /// - /// Output only. Harm severity levels in the content. This field is not supported in Gemini API. + /// Output only. The severity of harm for this category. This field is not supported in Gemini + /// API. /// [JsonPropertyName("severity")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -87,7 +90,8 @@ public HarmSeverity } /// - /// Output only. Harm severity score. This field is not supported in Gemini API. + /// Output only. The severity score of harm for this category. This field is not supported in + /// Gemini API. /// [JsonPropertyName("severityScore")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/SafetySetting.cs b/Google.GenAI/types/SafetySetting.cs index 0846c02b..860beba7 100644 --- a/Google.GenAI/types/SafetySetting.cs +++ b/Google.GenAI/types/SafetySetting.cs @@ -23,21 +23,21 @@ namespace Google.GenAI.Types { /// - /// Safety settings. + /// A safety setting that affects the safety-blocking behavior. A SafetySetting consists of a harm + /// category and a threshold for that category. /// public record SafetySetting { /// - /// Harm category. + /// The harm category to be blocked. /// [JsonPropertyName("category")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public HarmCategory ? Category { get; set; } /// - /// Optional. Specify if the threshold is used for probability or severity score. If not - /// specified, the threshold is used for probability score. This field is not supported in - /// Gemini API. + /// Optional. The method for blocking content. If not specified, the default behavior is to use + /// the probability score. This field is not supported in Gemini API. /// [JsonPropertyName("method")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -47,7 +47,8 @@ public HarmBlockMethod } /// - /// The harm block threshold. + /// The threshold for blocking content. If the harm probability exceeds this threshold, the + /// content will be blocked. /// [JsonPropertyName("threshold")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/SearchEntryPoint.cs b/Google.GenAI/types/SearchEntryPoint.cs index 5301184a..b950fa79 100644 --- a/Google.GenAI/types/SearchEntryPoint.cs +++ b/Google.GenAI/types/SearchEntryPoint.cs @@ -23,7 +23,7 @@ namespace Google.GenAI.Types { /// - /// Google search entry point. + /// The entry point used to search for grounding sources. /// public record SearchEntryPoint { @@ -35,7 +35,7 @@ public record SearchEntryPoint { public string ? RenderedContent { get; set; } /// - /// Optional. Base64 encoded JSON representing array of tuple. + /// Optional. JSON representing array of tuples. /// [JsonPropertyName("sdkBlob")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/Segment.cs b/Google.GenAI/types/Segment.cs index 5527d918..ccea84d6 100644 --- a/Google.GenAI/types/Segment.cs +++ b/Google.GenAI/types/Segment.cs @@ -23,36 +23,36 @@ namespace Google.GenAI.Types { /// - /// Segment of the content. + /// Segment of the content this support belongs to. /// public record Segment { /// - /// Output only. End index in the given Part, measured in bytes. Offset from the start of the - /// Part, exclusive, starting at zero. + /// Output only. Start index in the given Part, measured in bytes. Offset from the start of the + /// Part, inclusive, starting at zero. /// - [JsonPropertyName("endIndex")] + [JsonPropertyName("startIndex")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public int ? EndIndex { get; set; } + public int ? StartIndex { get; set; } /// - /// Output only. The index of a Part object within its parent Content object. + /// Output only. End index in the given Part, measured in bytes. Offset from the start of the + /// Part, exclusive, starting at zero. /// - [JsonPropertyName("partIndex")] + [JsonPropertyName("endIndex")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public int - ? PartIndex { + ? EndIndex { get; set; } /// - /// Output only. Start index in the given Part, measured in bytes. Offset from the start of the - /// Part, inclusive, starting at zero. + /// Output only. The index of a Part object within its parent Content object. /// - [JsonPropertyName("startIndex")] + [JsonPropertyName("partIndex")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public int - ? StartIndex { + ? PartIndex { get; set; } diff --git a/Google.GenAI/types/SpeakerVoiceConfig.cs b/Google.GenAI/types/SpeakerVoiceConfig.cs index 926ad13e..c1c6bc6a 100644 --- a/Google.GenAI/types/SpeakerVoiceConfig.cs +++ b/Google.GenAI/types/SpeakerVoiceConfig.cs @@ -23,7 +23,7 @@ namespace Google.GenAI.Types { /// - /// Configuration for a single speaker in a multi speaker setup. + /// Configuration for a single speaker in a multi-speaker setup. /// public record SpeakerVoiceConfig { diff --git a/Google.GenAI/types/SpeechConfig.cs b/Google.GenAI/types/SpeechConfig.cs index ba2401ff..89a590fd 100644 --- a/Google.GenAI/types/SpeechConfig.cs +++ b/Google.GenAI/types/SpeechConfig.cs @@ -23,35 +23,35 @@ namespace Google.GenAI.Types { /// - /// The speech generation config. + /// Configuration for speech generation. /// public record SpeechConfig { /// - /// Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization. + /// Optional. The language code (ISO 639-1) for the speech synthesis. /// [JsonPropertyName("languageCode")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string ? LanguageCode { get; set; } /// - /// The configuration for the speaker to use. + /// The configuration for a multi-speaker text-to-speech request. This field is mutually + /// exclusive with `voice_config`. /// - [JsonPropertyName("voiceConfig")] + [JsonPropertyName("multiSpeakerVoiceConfig")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public VoiceConfig - ? VoiceConfig { + public MultiSpeakerVoiceConfig + ? MultiSpeakerVoiceConfig { get; set; } /// - /// Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the - /// voice_config field. This field is not supported in Vertex AI. + /// The configuration for the voice to use. /// - [JsonPropertyName("multiSpeakerVoiceConfig")] + [JsonPropertyName("voiceConfig")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public MultiSpeakerVoiceConfig - ? MultiSpeakerVoiceConfig { + public VoiceConfig + ? VoiceConfig { get; set; } diff --git a/Google.GenAI/types/UrlContextMetadata.cs b/Google.GenAI/types/UrlContextMetadata.cs index b76f4505..ff020400 100644 --- a/Google.GenAI/types/UrlContextMetadata.cs +++ b/Google.GenAI/types/UrlContextMetadata.cs @@ -23,12 +23,13 @@ namespace Google.GenAI.Types { /// - /// Metadata related to url context retrieval tool. + /// Metadata returned when the model uses the `url_context` tool to get information from a + /// user-provided URL. /// public record UrlContextMetadata { /// - /// Output only. List of url context. + /// Output only. A list of URL metadata, with one entry for each URL retrieved by the tool. /// [JsonPropertyName("urlMetadata")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/UrlMetadata.cs b/Google.GenAI/types/UrlMetadata.cs index dc2ca14e..ccd2e23a 100644 --- a/Google.GenAI/types/UrlMetadata.cs +++ b/Google.GenAI/types/UrlMetadata.cs @@ -23,19 +23,19 @@ namespace Google.GenAI.Types { /// - /// Context of the a single url retrieval. + /// The metadata for a single URL retrieval. /// public record UrlMetadata { /// - /// Retrieved url by the tool. + /// The URL retrieved by the tool. /// [JsonPropertyName("retrievedUrl")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string ? RetrievedUrl { get; set; } /// - /// Status of the url retrieval. + /// The status of the URL retrieval. /// [JsonPropertyName("urlRetrievalStatus")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/UrlRetrievalStatus.cs b/Google.GenAI/types/UrlRetrievalStatus.cs index 48d4e1fd..fda3f661 100644 --- a/Google.GenAI/types/UrlRetrievalStatus.cs +++ b/Google.GenAI/types/UrlRetrievalStatus.cs @@ -20,7 +20,7 @@ namespace Google.GenAI.Types { /// - /// Status of the url retrieval. + /// The status of the URL retrieval. /// [JsonConverter(typeof(JsonStringEnumConverter))] public enum UrlRetrievalStatus { @@ -30,12 +30,12 @@ public enum UrlRetrievalStatus { [JsonPropertyName("URL_RETRIEVAL_STATUS_UNSPECIFIED")] URL_RETRIEVAL_STATUS_UNSPECIFIED, /// - /// Url retrieval is successful. + /// The URL was retrieved successfully. /// [JsonPropertyName("URL_RETRIEVAL_STATUS_SUCCESS")] URL_RETRIEVAL_STATUS_SUCCESS, /// - /// Url retrieval is failed due to error. + /// The URL retrieval failed. /// [JsonPropertyName("URL_RETRIEVAL_STATUS_ERROR")] URL_RETRIEVAL_STATUS_ERROR, diff --git a/Google.GenAI/types/VideoMetadata.cs b/Google.GenAI/types/VideoMetadata.cs index b7bde237..777faa8c 100644 --- a/Google.GenAI/types/VideoMetadata.cs +++ b/Google.GenAI/types/VideoMetadata.cs @@ -23,7 +23,8 @@ namespace Google.GenAI.Types { /// - /// Metadata describes the input video content. + /// Provides metadata for a video, including the start and end offsets for clipping and the frame + /// rate. /// public record VideoMetadata { @@ -36,7 +37,7 @@ public record VideoMetadata { /// /// Optional. The frame rate of the video sent to the model. If not specified, the default value - /// will be 1.0. The fps range is (0.0, 24.0]. + /// is 1.0. The valid range is (0.0, 24.0]. /// [JsonPropertyName("fps")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] diff --git a/Google.GenAI/types/VoiceConfig.cs b/Google.GenAI/types/VoiceConfig.cs index 07987535..9ca40faf 100644 --- a/Google.GenAI/types/VoiceConfig.cs +++ b/Google.GenAI/types/VoiceConfig.cs @@ -23,12 +23,12 @@ namespace Google.GenAI.Types { /// - /// The configuration for the voice to use. + /// Configuration for a voice. /// public record VoiceConfig { /// - /// The configuration for the prebuilt voice to use. + /// The configuration for a prebuilt voice. /// [JsonPropertyName("prebuiltVoiceConfig")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]