Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 88 additions & 19 deletions Google.GenAI/Batches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using Google.GenAI.Types;

using System;
using Google.GenAI.Types;

Check warning on line 27 in Google.GenAI/Batches.cs

View workflow job for this annotation

GitHub Actions / unit-e2e-tests

The using directive for 'Google.GenAI.Types' appeared previously in this namespace

Check warning on line 27 in Google.GenAI/Batches.cs

View workflow job for this annotation

GitHub Actions / unit-e2e-tests

The using directive for 'Google.GenAI.Types' appeared previously in this namespace
using System.Collections.Generic;
using System.Threading.Tasks;

Expand All @@ -33,6 +33,45 @@
public sealed class Batches {
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 BatchJobDestinationFromMldev(JsonNode fromObject, JsonObject parentObject) {
JsonObject toObject = new JsonObject();

Expand Down Expand Up @@ -423,17 +462,17 @@
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" }));
Expand Down Expand Up @@ -1110,6 +1149,11 @@
Common.GetValueByPath(fromObject, new string[] { "usageMetadata" }));
}

if (Common.GetValueByPath(fromObject, new string[] { "modelStatus" }) != null) {
Common.SetValueByPath(toObject, new string[] { "modelStatus" },
Common.GetValueByPath(fromObject, new string[] { "modelStatus" }));
}

return toObject;
}

Expand Down Expand Up @@ -1144,8 +1188,12 @@
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) {
Expand All @@ -1159,16 +1207,16 @@
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" },
Expand Down Expand Up @@ -1206,6 +1254,12 @@
"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.");
}

return toObject;
}

Expand Down Expand Up @@ -1466,6 +1520,11 @@
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;
}

Expand Down Expand Up @@ -1521,6 +1580,14 @@
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" }));
Expand All @@ -1538,14 +1605,6 @@
Common.GetValueByPath(fromObject, new string[] { "functionDeclarations" }));
}

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" },
Expand All @@ -1560,11 +1619,21 @@
Common.GetValueByPath(fromObject, new string[] { "googleSearchRetrieval" }));
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "parallelAiSearch" }))) {
throw new NotSupportedException(
"parallelAiSearch parameter is not supported in Gemini API.");
}

if (Common.GetValueByPath(fromObject, new string[] { "urlContext" }) != null) {
Common.SetValueByPath(toObject, new string[] { "urlContext" },
Common.GetValueByPath(fromObject, new string[] { "urlContext" }));
}

if (Common.GetValueByPath(fromObject, new string[] { "mcpServers" }) != null) {
Common.SetValueByPath(toObject, new string[] { "mcpServers" },
Common.GetValueByPath(fromObject, new string[] { "mcpServers" }));
}

return toObject;
}

Expand Down Expand Up @@ -1954,7 +2023,7 @@
/// Makes an API request to list the available batch jobs.
/// </summary>
/// <param name="config">A <see cref="ListBatchJobsConfig"/> for configuring the list
/// request.</param> <returns>A <see cref="Pager{BatchJob}"/> object that contains the list of

Check warning on line 2026 in Google.GenAI/Batches.cs

View workflow job for this annotation

GitHub Actions / unit-e2e-tests

XML comment has cref attribute 'Pager{BatchJob}' that could not be resolved

Check warning on line 2026 in Google.GenAI/Batches.cs

View workflow job for this annotation

GitHub Actions / unit-e2e-tests

XML comment has cref attribute 'Pager{BatchJob}' that could not be resolved
/// batch jobs. The pager is an
/// iterable and automatically queries the next page once the current page is
/// exhausted.</returns>
Expand Down
Loading
Loading