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
170 changes: 88 additions & 82 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 Down Expand Up @@ -878,72 +878,66 @@
JsonObject parentObject) {
JsonObject toObject = new JsonObject();

if (Common.GetValueByPath(fromObject, new string[] { "systemInstruction" }) != null) {
Common.SetValueByPath(
parentObject, new string[] { "systemInstruction" },
ContentToMldev(
JsonNode.Parse(JsonSerializer.Serialize(Transformers.TContent(
Common.GetValueByPath(fromObject, new string[] { "systemInstruction" })))),
toObject));
}

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

if (Common.GetValueByPath(fromObject, new string[] { "topP" }) != null) {
Common.SetValueByPath(toObject, new string[] { "topP" },
Common.GetValueByPath(fromObject, new string[] { "topP" }));
if (!Common.IsZero(
Common.GetValueByPath(fromObject, new string[] { "modelSelectionConfig" }))) {
throw new NotSupportedException(
"modelSelectionConfig parameter is not supported in Gemini API.");
}

if (Common.GetValueByPath(fromObject, new string[] { "topK" }) != null) {
Common.SetValueByPath(toObject, new string[] { "topK" },
Common.GetValueByPath(fromObject, new string[] { "topK" }));
if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "audioTimestamp" }))) {
throw new NotSupportedException("audioTimestamp parameter is not supported in Gemini API.");
}

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

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

if (Common.GetValueByPath(fromObject, new string[] { "stopSequences" }) != null) {
Common.SetValueByPath(toObject, new string[] { "stopSequences" },
Common.GetValueByPath(fromObject, new string[] { "stopSequences" }));
if (!Common.IsZero(
Common.GetValueByPath(fromObject, new string[] { "enableAffectiveDialog" }))) {
throw new NotSupportedException(
"enableAffectiveDialog parameter is not supported in Gemini API.");
}

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

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

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

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[] { "presencePenalty" }) != null) {
Common.SetValueByPath(
toObject, new string[] { "presencePenalty" },
Common.GetValueByPath(fromObject, new string[] { "presencePenalty" }));
}

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

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

if (Common.GetValueByPath(fromObject, new string[] { "responseMimeType" }) != null) {
Expand All @@ -952,26 +946,72 @@
Common.GetValueByPath(fromObject, new string[] { "responseMimeType" }));
}

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

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

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

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

if (!Common.IsZero(
Common.GetValueByPath(fromObject, new string[] { "modelSelectionConfig" }))) {
throw new NotSupportedException(
"modelSelectionConfig parameter is not supported in Gemini API.");
if (Common.GetValueByPath(fromObject, new string[] { "seed" }) != null) {
Common.SetValueByPath(toObject, new string[] { "seed" },
Common.GetValueByPath(fromObject, new string[] { "seed" }));
}

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

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

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

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

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

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

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

if (Common.GetValueByPath(fromObject, new string[] { "systemInstruction" }) != null) {
Common.SetValueByPath(
parentObject, new string[] { "systemInstruction" },
ContentToMldev(
JsonNode.Parse(JsonSerializer.Serialize(Transformers.TContent(
Common.GetValueByPath(fromObject, new string[] { "systemInstruction" })))),
toObject));
}

if (Common.GetValueByPath(fromObject, new string[] { "safetySettings" }) != null) {
Expand Down Expand Up @@ -1018,33 +1058,6 @@
Common.GetValueByPath(fromObject, new string[] { "cachedContent" })));
}

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

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[] { "speechConfig" }) != null) {
Common.SetValueByPath(toObject, new string[] { "speechConfig" },
Transformers.TSpeechConfig(Common.GetValueByPath(
fromObject, new string[] { "speechConfig" })));
}

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

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

if (Common.GetValueByPath(fromObject, new string[] { "imageConfig" }) != null) {
Common.SetValueByPath(
toObject, new string[] { "imageConfig" },
Expand All @@ -1053,13 +1066,6 @@
toObject));
}

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

return toObject;
}

Expand Down Expand Up @@ -1949,7 +1955,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 1958 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 1958 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
12 changes: 6 additions & 6 deletions Google.GenAI/LiveConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,6 @@ internal JsonNode GenerationConfigToVertex(JsonNode fromObject, JsonObject paren
Common.GetValueByPath(fromObject, new string[] { "modelSelectionConfig" }));
}

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

if (Common.GetValueByPath(fromObject, new string[] { "audioTimestamp" }) != null) {
Common.SetValueByPath(toObject, new string[] { "audioTimestamp" },
Common.GetValueByPath(fromObject, new string[] { "audioTimestamp" }));
Expand Down Expand Up @@ -237,6 +231,12 @@ internal JsonNode GenerationConfigToVertex(JsonNode fromObject, JsonObject paren
Common.GetValueByPath(fromObject, new string[] { "presencePenalty" }));
}

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

if (Common.GetValueByPath(fromObject, new string[] { "responseLogprobs" }) != null) {
Common.SetValueByPath(
toObject, new string[] { "responseLogprobs" },
Expand Down
Loading
Loading