Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Google.GenAI.E2E.Tests/ComputeTokens/ComputeTokensTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public async Task ComputeTokensGeminiTest() {
model: modelName, contents: contents, config: null);
});

StringAssert.Contains(ex.Message, "only supported in the Vertex AI");
StringAssert.Contains(ex.Message, "only supported in the Gemini Enterprise Agent Platform");
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ await geminiClient.Models.EditImageAsync(
config: editImageConfig);
});

StringAssert.Contains(ex.Message, "only supported in the Vertex AI client");
StringAssert.Contains(ex.Message, "only supported in the Gemini Enterprise Agent Platform");
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion Google.GenAI.E2E.Tests/SegmentImage/SegmentImageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ await geminiClient.Models.SegmentImageAsync(
config: segmentImageConfig);
});

StringAssert.Contains(ex.Message, "only supported in the Vertex AI client");
StringAssert.Contains(ex.Message, "only supported in the Gemini Enterprise Agent Platform");
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion Google.GenAI.E2E.Tests/Tunings/ListTuningsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ public async Task ListTuningsGeminiTest()
await geminiClient.Tunings.ListAsync(new ListTuningJobsConfig { PageSize = 1 });
});

StringAssert.Contains(ex.Message, "only supported in the Vertex AI client");
StringAssert.Contains(ex.Message, "only supported in the Gemini Enterprise Agent Platform");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ await geminiClient.Models.UpscaleImageAsync(
upscaleFactor: "x2", config: null);
});

StringAssert.Contains(ex.Message, "This method is only supported in the Vertex AI client.");
StringAssert.Contains(ex.Message, "This method is only supported in the Gemini Enterprise Agent Platform");
}
}
49 changes: 28 additions & 21 deletions Google.GenAI/Batches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,19 @@ internal JsonNode BatchJobDestinationToVertex(JsonNode fromObject, JsonObject pa
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "fileName" }))) {
throw new NotSupportedException("fileName parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "inlinedResponses" }))) {
throw new NotSupportedException(
"inlinedResponses parameter is not supported in Vertex AI.");
"inlinedResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (!Common.IsZero(
Common.GetValueByPath(fromObject, new string[] { "inlinedEmbedContentResponses" }))) {
throw new NotSupportedException(
"inlinedEmbedContentResponses parameter is not supported in Vertex AI.");
"inlinedEmbedContentResponses parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (Common.GetValueByPath(fromObject, new string[] { "vertexDataset" }) != null) {
Expand Down Expand Up @@ -406,11 +407,13 @@ internal JsonNode BatchJobSourceToVertex(JsonNode fromObject, JsonObject parentO
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "fileName" }))) {
throw new NotSupportedException("fileName parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"fileName parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "inlinedRequests" }))) {
throw new NotSupportedException("inlinedRequests parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"inlinedRequests parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (Common.GetValueByPath(fromObject, new string[] { "vertexDatasetName" }) != null) {
Expand Down Expand Up @@ -601,7 +604,8 @@ internal JsonNode CreateBatchJobConfigToVertex(JsonNode fromObject, JsonObject p
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "webhookConfig" }))) {
throw new NotSupportedException("webhookConfig parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"webhookConfig parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

return toObject;
Expand Down Expand Up @@ -1879,10 +1883,10 @@ await this._apiClient.RequestAsync(HttpMethod.Post, path, JsonSerializer.Seriali
/// <param name="name">A fully-qualified BatchJob resource name or ID.
/// Example: "projects/.../locations/.../batchPredictionJobs/456"
/// or "456" when project and location are initialized in the
/// Vertex AI client. Or "batches/abc" using the Gemini Developer AI client.</param>
/// <param name="config">A <see cref="GetBatchJobConfig"/> for configuring the get
/// request.</param> <param name="cancellationToken">The <see cref="CancellationToken"/> for the
/// request.</param> <returns>A <see cref="BatchJob"/> object that contains the info of the
/// Gemini Enterprise Agent Platform client. Or "batches/abc" using the Gemini Developer AI
/// client.</param> <param name="config">A <see cref="GetBatchJobConfig"/> for configuring the
/// get request.</param> <param name="cancellationToken">The <see cref="CancellationToken"/> for
/// the request.</param> <returns>A <see cref="BatchJob"/> object that contains the info of the
/// batch job.</returns>

public async Task<BatchJob> GetAsync(string name, GetBatchJobConfig? config = null,
Expand Down Expand Up @@ -2086,11 +2090,11 @@ await this._apiClient.RequestAsync(HttpMethod.Get, path, JsonSerializer.Serializ
/// <param name="name">A fully-qualified BatchJob resource name or ID.
/// Example: "projects/.../locations/.../batchPredictionJobs/456"
/// or "456" when project and location are initialized in the
/// Vertex AI client. Or "batches/abc" using the Gemini Developer AI client.</param>
/// <param name="config">A <see cref="DeleteBatchJobConfig"/> for configuring the delete
/// request.</param> <param name="cancellationToken">The <see cref="CancellationToken"/> for the
/// request.</param> <returns>A <see cref="DeleteResourceJob"/> object that shows the status of
/// the deletion.</returns>
/// Gemini Enterprise Agent Platform client. Or "batches/abc" using the Gemini Developer AI
/// client.</param> <param name="config">A <see cref="DeleteBatchJobConfig"/> for configuring
/// the delete request.</param> <param name="cancellationToken">The <see
/// cref="CancellationToken"/> for the request.</param> <returns>A <see
/// cref="DeleteResourceJob"/> object that shows the status of the deletion.</returns>

public async Task<DeleteResourceJob> DeleteAsync(
string name, DeleteBatchJobConfig? config = null,
Expand Down Expand Up @@ -2186,9 +2190,9 @@ public async Task<Pager<BatchJob, ListBatchJobsConfig, ListBatchJobsResponse>> L
/// </summary>
/// <param name="model">The model to use for the batch job.</param>
/// <param name="src">The <see cref="BatchJobSource"/> of the batch job.
/// Currently Vertex AI supports GCS URIs or BigQuery URI. Example: "gs://path/to/input/data" or
/// "bq://projectId.bqDatasetId.bqTableId". Gemini Developer API supports List of
/// inlined_request, or file name. Example: "files/file_name".</param> <param
/// Currently Gemini Enterprise Agent Platform supports GCS URIs or BigQuery URI. Example:
/// "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId". Gemini Developer API
/// supports List of inlined_request, or file name. Example: "files/file_name".</param> <param
/// name="config">Optional <see cref="CreateBatchJobConfig"/> to configure the batch
/// job.</param> <param name="cancellationToken">The cancellation token for the request.</param>
/// <returns>A <see cref="Task{BatchJob}"/> that represents the asynchronous operation. The task
Expand All @@ -2198,10 +2202,12 @@ public async Task<BatchJob> CreateAsync(string model, BatchJobSource src,
CancellationToken cancellationToken = default) {
if (this._apiClient.VertexAI) {
if (src.InlinedRequests != null) {
throw new NotSupportedException("inlinedRequests is not supported for Vertex AI.");
throw new NotSupportedException(
"inlinedRequests is not supported for Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}
if (src.FileName != null) {
throw new NotSupportedException("fileName is not supported for Vertex AI.");
throw new NotSupportedException(
"fileName is not supported for Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}
if (src.GcsUri != null && src.BigqueryUri != null) {
throw new ArgumentException("Only one of gcsUri and bigqueryUri can be set.");
Expand Down Expand Up @@ -2235,7 +2241,8 @@ public async Task<BatchJob> CreateEmbeddingsAsync(
string model, EmbeddingsBatchJobSource src, CreateEmbeddingsBatchJobConfig config,
CancellationToken cancellationToken = default) {
if (this._apiClient.VertexAI) {
throw new NotSupportedException("Vertex AI does not support batches.createEmbeddings.");
throw new NotSupportedException(
"Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches.createEmbeddings.");
}
return await this.PrivateCreateEmbeddingsAsync(model, src, config, cancellationToken);
}
Expand Down
20 changes: 13 additions & 7 deletions Google.GenAI/Caches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ internal JsonNode FunctionDeclarationToVertex(JsonNode fromObject, JsonObject pa
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "behavior" }))) {
throw new NotSupportedException("behavior parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

return toObject;
Expand Down Expand Up @@ -793,15 +794,18 @@ internal JsonNode PartToVertex(JsonNode fromObject, JsonObject parentObject) {
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "toolCall" }))) {
throw new NotSupportedException("toolCall parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "toolResponse" }))) {
throw new NotSupportedException("toolResponse parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "partMetadata" }))) {
throw new NotSupportedException("partMetadata parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

return toObject;
Expand Down Expand Up @@ -852,7 +856,7 @@ internal JsonNode ToolConfigToVertex(JsonNode fromObject, JsonObject parentObjec
if (!Common.IsZero(Common.GetValueByPath(
fromObject, new string[] { "includeServerSideToolInvocations" }))) {
throw new NotSupportedException(
"includeServerSideToolInvocations parameter is not supported in Vertex AI.");
"includeServerSideToolInvocations parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

return toObject;
Expand Down Expand Up @@ -944,7 +948,8 @@ internal JsonNode ToolToVertex(JsonNode fromObject, JsonObject parentObject) {
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "fileSearch" }))) {
throw new NotSupportedException("fileSearch parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (Common.GetValueByPath(fromObject, new string[] { "googleSearch" }) != null) {
Expand Down Expand Up @@ -997,7 +1002,8 @@ internal JsonNode ToolToVertex(JsonNode fromObject, JsonObject parentObject) {
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "mcpServers" }))) {
throw new NotSupportedException("mcpServers parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

return toObject;
Expand Down
23 changes: 15 additions & 8 deletions Google.GenAI/LiveConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ internal JsonNode FunctionDeclarationToVertex(JsonNode fromObject, JsonObject pa
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "behavior" }))) {
throw new NotSupportedException("behavior parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"behavior parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

return toObject;
Expand Down Expand Up @@ -360,7 +361,7 @@ internal JsonNode GenerationConfigToVertex(JsonNode fromObject, JsonObject paren
if (!Common.IsZero(
Common.GetValueByPath(fromObject, new string[] { "enableEnhancedCivicAnswers" }))) {
throw new NotSupportedException(
"enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");
"enableEnhancedCivicAnswers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

return toObject;
Expand Down Expand Up @@ -603,7 +604,8 @@ internal JsonNode LiveClientRealtimeInputToVertex(JsonNode fromObject,
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "audioStreamEnd" }))) {
throw new NotSupportedException("audioStreamEnd parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"audioStreamEnd parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (Common.GetValueByPath(fromObject, new string[] { "video" }) != null) {
Expand Down Expand Up @@ -1519,15 +1521,18 @@ internal JsonNode PartToVertex(JsonNode fromObject, JsonObject parentObject) {
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "toolCall" }))) {
throw new NotSupportedException("toolCall parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"toolCall parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "toolResponse" }))) {
throw new NotSupportedException("toolResponse parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"toolResponse parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "partMetadata" }))) {
throw new NotSupportedException("partMetadata parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"partMetadata parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

return toObject;
Expand Down Expand Up @@ -1654,7 +1659,8 @@ internal JsonNode ToolToVertex(JsonNode fromObject, JsonObject parentObject) {
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "fileSearch" }))) {
throw new NotSupportedException("fileSearch parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"fileSearch parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

if (Common.GetValueByPath(fromObject, new string[] { "googleSearch" }) != null) {
Expand Down Expand Up @@ -1707,7 +1713,8 @@ internal JsonNode ToolToVertex(JsonNode fromObject, JsonObject parentObject) {
}

if (!Common.IsZero(Common.GetValueByPath(fromObject, new string[] { "mcpServers" }))) {
throw new NotSupportedException("mcpServers parameter is not supported in Vertex AI.");
throw new NotSupportedException(
"mcpServers parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");
}

return toObject;
Expand Down
Loading
Loading