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
1 change: 0 additions & 1 deletion src/GeminiDotnet.Extensions.AI/GeminiToMEAIMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using GeminiDotnet.V1Beta.Models;
using Microsoft.Extensions.AI;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;

#pragma warning disable MEAI001 // Experimental API (CodeInterpreter*, WebSearchTool*Content)
Expand Down
2 changes: 1 addition & 1 deletion src/GeminiDotnet/V1/API_REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20260310
20260426
7 changes: 7 additions & 0 deletions src/GeminiDotnet/V1/GenerateContentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ public sealed record GenerateContentRequest
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public IReadOnlyList<SafetySetting>? SafetySettings { get; init; }

/// <summary>
/// Optional. The service tier of the request.
/// </summary>
[JsonPropertyName("serviceTier")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public ServiceTier? ServiceTier { get; init; }

/// <summary>
/// Optional. Configures the logging behavior for a given request. If set, it takes
/// precedence over the project-level logging config.
Expand Down
7 changes: 7 additions & 0 deletions src/GeminiDotnet/V1/Models/BatchEmbedContentsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,12 @@ public sealed record BatchEmbedContentsResponse
[JsonPropertyName("embeddings")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public IReadOnlyList<ContentEmbedding>? Embeddings { get; init; }

/// <summary>
/// Output only. The usage metadata for the request.
/// </summary>
[JsonPropertyName("usageMetadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public EmbeddingUsageMetadata? UsageMetadata { get; init; }
}

20 changes: 14 additions & 6 deletions src/GeminiDotnet/V1/Models/Blob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ public sealed record Blob

/// <summary>
/// The IANA standard MIME type of the source data.
/// Examples:
/// - image/png
/// - image/jpeg
/// If an unsupported MIME type is provided, an error will be returned. For a
/// complete list of supported types, see [Supported file
/// formats](https://ai.google.dev/gemini-api/docs/prompting_with_media#supported_file_formats).
/// Examples of supported types:
/// - Images: image/png, image/jpeg, image/jpg, image/webp, image/heic,
/// image/heif, image/gif, image/avif
/// - Audio: audio/*, video/audio/s16le, video/audio/wav
/// - Video: video/*
/// - Text: text/plain, text/html, text/css, text/javascript,
/// text/x-typescript, text/csv, text/markdown, text/x-python, text/xml,
/// text/rtf, video/text/timestamp
/// - Applications: application/x-javascript, application/x-typescript,
/// application/x-python-code, application/json, application/x-ipynb+json,
/// application/rtf, application/pdf For additional context,
/// see [Supported file
/// formats](https://ai.google.dev/gemini-api/docs/file-input-methods#supported-content-types).
/// //
/// </summary>
[JsonPropertyName("mimeType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
Expand Down
54 changes: 54 additions & 0 deletions src/GeminiDotnet/V1/Models/EmbedContentConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System.Text.Json.Serialization;

namespace GeminiDotnet.V1.Models;

/// <summary>
/// Configurations for the EmbedContent request.
/// </summary>
public sealed record EmbedContentConfiguration
{
/// <summary>
/// Optional. Whether to extract audio from video content.
/// </summary>
[JsonPropertyName("audioTrackExtraction")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? AudioTrackExtraction { get; init; }

/// <summary>
/// Optional. Whether to silently truncate the input content if it's longer
/// than the maximum sequence length.
/// </summary>
[JsonPropertyName("autoTruncate")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? AutoTruncate { get; init; }

/// <summary>
/// Optional. Whether to enable OCR for document content.
/// </summary>
[JsonPropertyName("documentOcr")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? DocumentOcr { get; init; }

/// <summary>
/// Optional. Reduced dimension for the output embedding. If set, excessive
/// values in the output embedding are truncated from the end.
/// </summary>
[JsonPropertyName("outputDimensionality")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int? OutputDimensionality { get; init; }

/// <summary>
/// Optional. The task type of the embedding.
/// </summary>
[JsonPropertyName("taskType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public TaskType? TaskType { get; init; }

/// <summary>
/// Optional. The title for the text.
/// </summary>
[JsonPropertyName("title")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? Title { get; init; }
}

16 changes: 13 additions & 3 deletions src/GeminiDotnet/V1/Models/EmbedContentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public sealed record EmbedContentRequest
[JsonPropertyName("content")]
public required Content Content { get; init; }

/// <summary>
/// Optional. Configuration for the EmbedContent request.
/// </summary>
[JsonPropertyName("embedContentConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public EmbedContentConfiguration? EmbedContentConfiguration { get; init; }

/// <summary>
/// Required. The model's resource name. This serves as an ID for the Model to use.
/// This name should match a model name returned by the <c>ListModels</c> method.
Expand All @@ -22,7 +29,8 @@ public sealed record EmbedContentRequest
public required string Model { get; init; }

/// <summary>
/// Optional. Optional reduced dimension for the output embedding. If set, excessive
/// Optional. Deprecated: Please use EmbedContentConfig.output_dimensionality instead.
/// Optional reduced dimension for the output embedding. If set, excessive
/// values in the output embedding are truncated from the end. Supported by
/// newer models since 2024 only. You cannot set this value if using the
/// earlier model (<c>models/embedding-001</c>).
Expand All @@ -32,15 +40,17 @@ public sealed record EmbedContentRequest
public int? OutputDimensionality { get; init; }

/// <summary>
/// Optional. Optional task type for which the embeddings will be used. Not supported on
/// Optional. Deprecated: Please use EmbedContentConfig.task_type instead.
/// Optional task type for which the embeddings will be used. Not supported on
/// earlier models (<c>models/embedding-001</c>).
/// </summary>
[JsonPropertyName("taskType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public TaskType? TaskType { get; init; }

/// <summary>
/// Optional. An optional title for the text. Only applicable when TaskType is
/// Optional. Deprecated: Please use EmbedContentConfig.title instead.
/// An optional title for the text. Only applicable when TaskType is
/// <c>RETRIEVAL_DOCUMENT</c>.
/// Note: Specifying a <see cref="Title"/> for <c>RETRIEVAL_DOCUMENT</c> provides better quality
/// embeddings for retrieval.
Expand Down
7 changes: 7 additions & 0 deletions src/GeminiDotnet/V1/Models/EmbedContentResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@ public sealed record EmbedContentResponse
[JsonPropertyName("embedding")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public ContentEmbedding? Embedding { get; init; }

/// <summary>
/// Output only. The usage metadata for the request.
/// </summary>
[JsonPropertyName("usageMetadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public EmbeddingUsageMetadata? UsageMetadata { get; init; }
}

24 changes: 24 additions & 0 deletions src/GeminiDotnet/V1/Models/EmbeddingUsageMetadata.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Text.Json.Serialization;

namespace GeminiDotnet.V1.Models;

/// <summary>
/// Metadata on the usage of the embedding request.
/// </summary>
public sealed record EmbeddingUsageMetadata
{
/// <summary>
/// Output only. Number of tokens in the prompt.
/// </summary>
[JsonPropertyName("promptTokenCount")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int? PromptTokenCount { get; init; }

/// <summary>
/// Output only. List of modalities that were processed in the request input.
/// </summary>
[JsonPropertyName("promptTokenDetails")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public IReadOnlyList<ModalityTokenCount>? PromptTokenDetails { get; init; }
}

32 changes: 32 additions & 0 deletions src/GeminiDotnet/V1/ServiceTier.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Text.Json.Serialization;

namespace GeminiDotnet.V1;

[JsonConverter(typeof(JsonStringEnumConverter<ServiceTier>))]
public enum ServiceTier
{
/// <summary>
/// Default service tier, which is standard.
/// </summary>
[JsonStringEnumMemberName("unspecified")]
Unspecified,

/// <summary>
/// Standard service tier.
/// </summary>
[JsonStringEnumMemberName("standard")]
Standard,

/// <summary>
/// Flex service tier.
/// </summary>
[JsonStringEnumMemberName("flex")]
Flex,

/// <summary>
/// Priority service tier.
/// </summary>
[JsonStringEnumMemberName("priority")]
Priority,
}

2 changes: 1 addition & 1 deletion src/GeminiDotnet/V1Beta/API_REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20260310
20260426
20 changes: 14 additions & 6 deletions src/GeminiDotnet/V1Beta/Blob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ public sealed record Blob

/// <summary>
/// The IANA standard MIME type of the source data.
/// Examples:
/// - image/png
/// - image/jpeg
/// If an unsupported MIME type is provided, an error will be returned. For a
/// complete list of supported types, see [Supported file
/// formats](https://ai.google.dev/gemini-api/docs/prompting_with_media#supported_file_formats).
/// Examples of supported types:
/// - Images: image/png, image/jpeg, image/jpg, image/webp, image/heic,
/// image/heif, image/gif, image/avif
/// - Audio: audio/*, video/audio/s16le, video/audio/wav
/// - Video: video/*
/// - Text: text/plain, text/html, text/css, text/javascript,
/// text/x-typescript, text/csv, text/markdown, text/x-python, text/xml,
/// text/rtf, video/text/timestamp
/// - Applications: application/x-javascript, application/x-typescript,
/// application/x-python-code, application/json, application/x-ipynb+json,
/// application/rtf, application/pdf For additional context,
/// see [Supported file
/// formats](https://ai.google.dev/gemini-api/docs/file-input-methods#supported-content-types).
/// //
/// </summary>
[JsonPropertyName("mimeType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
Expand Down
2 changes: 1 addition & 1 deletion src/GeminiDotnet/V1Beta/CachedContents/McpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace GeminiDotnet.V1Beta.CachedContents;
/// <summary>
/// A MCPServer is a server that can be called by the model to perform actions.
/// It is a server that implements the MCP protocol.
/// Next ID: 5
/// Next ID: 6
/// </summary>
public sealed record McpServer
{
Expand Down
4 changes: 2 additions & 2 deletions src/GeminiDotnet/V1Beta/CachedContents/SearchTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ namespace GeminiDotnet.V1Beta.CachedContents;
public sealed record SearchTypes
{
/// <summary>
/// Optional. Setting this field enables image search. Image bytes are returned.
/// Optional. Enables image search. Image bytes are returned.
/// </summary>
[JsonPropertyName("imageSearch")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public ImageSearch? ImageSearch { get; init; }

/// <summary>
/// Optional. Setting this field enables web search. Only text results are returned.
/// Optional. Enables web search. Only text results are returned.
/// </summary>
[JsonPropertyName("webSearch")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
Expand Down
2 changes: 1 addition & 1 deletion src/GeminiDotnet/V1Beta/CachedContents/Tool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace GeminiDotnet.V1Beta.CachedContents;
/// A <see cref="V1Beta.CachedContents.Tool"/> is a piece of code that enables the system to interact with
/// external systems to perform an action, or set of actions, outside of
/// knowledge and scope of the model.
/// Next ID: 15
/// Next ID: 16
/// </summary>
public sealed record Tool
{
Expand Down
9 changes: 9 additions & 0 deletions src/GeminiDotnet/V1Beta/CachedContents/ToolConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ public sealed record ToolConfiguration
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public FunctionCallingConfiguration? FunctionCallingConfiguration { get; init; }

/// <summary>
/// Optional. If true, the API response will include the server-side tool calls and
/// responses within the <see cref="V1Beta.Content"/> message. This allows clients to
/// observe the server's tool interactions.
/// </summary>
[JsonPropertyName("includeServerSideToolInvocations")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? IncludeServerSideToolInvocations { get; init; }

/// <summary>
/// Optional. Retrieval config.
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions src/GeminiDotnet/V1Beta/CodeExecutionResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ namespace GeminiDotnet.V1Beta;
/// </summary>
public sealed record CodeExecutionResult
{
/// <summary>
/// Optional. The identifier of the <see cref="V1Beta.ExecutableCode"/> part this result is for.
/// Only populated if the corresponding <see cref="V1Beta.ExecutableCode"/> has an id.
/// </summary>
[JsonPropertyName("id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? Id { get; init; }

/// <summary>
/// Required. Outcome of the code execution.
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions src/GeminiDotnet/V1Beta/ExecutableCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public sealed record ExecutableCode
[JsonPropertyName("code")]
public required string Code { get; init; }

/// <summary>
/// Optional. Unique identifier of the <see cref="V1Beta.ExecutableCode"/> part.
/// The server returns the <see cref="V1Beta.CodeExecutionResult"/> with the matching <see cref="Id"/>.
/// </summary>
[JsonPropertyName("id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? Id { get; init; }

/// <summary>
/// Required. Programming language of the <see cref="Code"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace GeminiDotnet.V1Beta.FileSearchStores;

/// <summary>
/// Request for <c>ImportFile</c> to import a File API file with a <see cref="V1Beta.FileSearchStores.FileSearchStore"/>.
/// LINT.IfChange(ImportFileRequest)
/// </summary>
public sealed record ImportFileRequest
{
Expand Down
7 changes: 7 additions & 0 deletions src/GeminiDotnet/V1Beta/GenerateContentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ public sealed record GenerateContentRequest
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public IReadOnlyList<SafetySetting>? SafetySettings { get; init; }

/// <summary>
/// Optional. The service tier of the request.
/// </summary>
[JsonPropertyName("serviceTier")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public ServiceTier? ServiceTier { get; init; }

/// <summary>
/// Optional. Configures the logging behavior for a given request. If set, it takes
/// precedence over the project-level logging config.
Expand Down
2 changes: 1 addition & 1 deletion src/GeminiDotnet/V1Beta/ImageConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed record ImageConfiguration
public string? AspectRatio { get; init; }

/// <summary>
/// Optional. Specifies the size of generated images. Supported values are <c>512PX</c>, <c>1K</c>,
/// Optional. Specifies the size of generated images. Supported values are <c>512</c>, <c>1K</c>,
/// <c>2K</c>, <c>4K</c>. If not specified, the model will use default value <c>1K</c>.
/// </summary>
[JsonPropertyName("imageSize")]
Expand Down
7 changes: 7 additions & 0 deletions src/GeminiDotnet/V1Beta/Models/BatchEmbedContentsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,12 @@ public sealed record BatchEmbedContentsResponse
[JsonPropertyName("embeddings")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public IReadOnlyList<ContentEmbedding>? Embeddings { get; init; }

/// <summary>
/// Output only. The usage metadata for the request.
/// </summary>
[JsonPropertyName("usageMetadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public EmbeddingUsageMetadata? UsageMetadata { get; init; }
}

Loading
Loading