Skip to content

Commit d8b03c5

Browse files
jscudcopybara-github
authored andcommitted
feat: Update data types from discovery doc.
PiperOrigin-RevId: 832486480
1 parent 2f59ba0 commit d8b03c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1045
-510
lines changed

Google.GenAI/LiveConverters.cs

Lines changed: 222 additions & 88 deletions
Large diffs are not rendered by default.

Google.GenAI/Models.cs

Lines changed: 249 additions & 147 deletions
Large diffs are not rendered by default.

Google.GenAI/types/Blob.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,23 @@
2323

2424
namespace Google.GenAI.Types {
2525
/// <summary>
26-
/// Content blob.
26+
/// A content blob. A Blob contains data of a specific media type. It is used to represent images,
27+
/// audio, and video.
2728
/// </summary>
2829

2930
public record Blob {
3031
/// <summary>
31-
/// Raw bytes.
32+
/// The raw bytes of the data.
3233
/// </summary>
3334
[JsonPropertyName("data")]
3435
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
3536
public byte[] ? Data { get; set; }
3637

3738
/// <summary>
38-
/// Optional. Display name of the blob. Used to provide a label or filename to distinguish
39-
/// blobs. This field is only returned in PromptMessage for prompt management. It is currently
40-
/// used in the Gemini GenerateContent calls only when server side tools (code_execution,
41-
/// google_search, and url_context) are enabled. This field is not supported in Gemini API.
39+
/// Optional. The display name of the blob. Used to provide a label or filename to distinguish
40+
/// blobs. This field is only returned in `PromptMessage` for prompt management. It is used in
41+
/// the Gemini calls only when server-side tools (`code_execution`, `google_search`, and
42+
/// `url_context`) are enabled. This field is not supported in Gemini API.
4243
/// </summary>
4344
[JsonPropertyName("displayName")]
4445
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]

Google.GenAI/types/Candidate.cs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,31 @@ public FinishReason
7676
}
7777

7878
/// <summary>
79-
/// Output only. Average log probability score of the candidate.
79+
/// Output only. Grounding metadata for the candidate. This field is populated for
80+
/// `GenerateContent` calls.
8081
/// </summary>
81-
[JsonPropertyName("avgLogprobs")]
82+
[JsonPropertyName("groundingMetadata")]
8283
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
83-
public double
84-
? AvgLogprobs {
84+
public GroundingMetadata
85+
? GroundingMetadata {
8586
get; set;
8687
}
8788

8889
/// <summary>
89-
/// Output only. Metadata specifies sources used to ground generated content.
90+
/// Output only. The average log probability of the tokens in this candidate. This is a
91+
/// length-normalized score that can be used to compare the quality of candidates of different
92+
/// lengths. A higher average log probability suggests a more confident and coherent response.
9093
/// </summary>
91-
[JsonPropertyName("groundingMetadata")]
94+
[JsonPropertyName("avgLogprobs")]
9295
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
93-
public GroundingMetadata
94-
? GroundingMetadata {
96+
public double
97+
? AvgLogprobs {
9598
get; set;
9699
}
97100

98101
/// <summary>
99-
/// Output only. Index of the candidate.
102+
/// Output only. The 0-based index of this candidate in the list of generated responses. This is
103+
/// useful for distinguishing between multiple candidates when `candidate_count` > 1.
100104
/// </summary>
101105
[JsonPropertyName("index")]
102106
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
@@ -106,7 +110,9 @@ public int
106110
}
107111

108112
/// <summary>
109-
/// Output only. Log-likelihood scores for the response tokens and top tokens
113+
/// Output only. The detailed log probability information for the tokens in this candidate. This
114+
/// is useful for debugging, understanding model uncertainty, and identifying potential
115+
/// "hallucinations".
110116
/// </summary>
111117
[JsonPropertyName("logprobsResult")]
112118
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
@@ -116,7 +122,7 @@ public LogprobsResult
116122
}
117123

118124
/// <summary>
119-
/// Output only. List of ratings for the safety of a response candidate. There is at most one
125+
/// Output only. A list of ratings for the safety of a response candidate. There is at most one
120126
/// rating per category.
121127
/// </summary>
122128
[JsonPropertyName("safetyRatings")]
@@ -127,7 +133,8 @@ public List<SafetyRating>
127133
}
128134

129135
/// <summary>
130-
/// Output only. Metadata related to url context retrieval tool.
136+
/// Output only. Metadata returned when the model uses the `url_context` tool to get information
137+
/// from a user-provided URL.
131138
/// </summary>
132139
[JsonPropertyName("urlContextMetadata")]
133140
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]

Google.GenAI/types/Citation.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@
2323

2424
namespace Google.GenAI.Types {
2525
/// <summary>
26-
/// Source attributions for content. This data type is not supported in Gemini API.
26+
/// A citation for a piece of generatedcontent. This data type is not supported in Gemini API.
2727
/// </summary>
2828

2929
public record Citation {
3030
/// <summary>
31-
/// Output only. End index into the content.
31+
/// Output only. The end index of the citation in the content.
3232
/// </summary>
3333
[JsonPropertyName("endIndex")]
3434
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
3535
public int ? EndIndex { get; set; }
3636

3737
/// <summary>
38-
/// Output only. License of the attribution.
38+
/// Output only. The license of the source of the citation.
3939
/// </summary>
4040
[JsonPropertyName("license")]
4141
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
@@ -45,7 +45,7 @@ public string
4545
}
4646

4747
/// <summary>
48-
/// Output only. Publication date of the attribution.
48+
/// Output only. The publication date of the source of the citation.
4949
/// </summary>
5050
[JsonPropertyName("publicationDate")]
5151
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
@@ -55,7 +55,7 @@ public GoogleTypeDate
5555
}
5656

5757
/// <summary>
58-
/// Output only. Start index into the content.
58+
/// Output only. The start index of the citation in the content.
5959
/// </summary>
6060
[JsonPropertyName("startIndex")]
6161
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
@@ -65,7 +65,7 @@ public int
6565
}
6666

6767
/// <summary>
68-
/// Output only. Title of the attribution.
68+
/// Output only. The title of the source of the citation.
6969
/// </summary>
7070
[JsonPropertyName("title")]
7171
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
@@ -75,7 +75,7 @@ public string
7575
}
7676

7777
/// <summary>
78-
/// Output only. Url reference of the attribution.
78+
/// Output only. The URI of the source of the citation.
7979
/// </summary>
8080
[JsonPropertyName("uri")]
8181
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]

Google.GenAI/types/Content.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public record Content {
3636
public List<Part> ? Parts { get; set; }
3737

3838
/// <summary>
39-
/// Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for
40-
/// multi-turn conversations, otherwise can be left blank or unset.
39+
/// Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the
40+
/// service will default to 'user'.
4141
/// </summary>
4242
[JsonPropertyName("role")]
4343
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]

Google.GenAI/types/EnterpriseWebSearch.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ namespace Google.GenAI.Types {
2929

3030
public record EnterpriseWebSearch {
3131
/// <summary>
32-
/// Optional. List of domains to be excluded from the search results. The default limit is 2000
33-
/// domains.
32+
/// Optional. Sites with confidence level chosen &amp; above this value will be blocked from the
33+
/// search results.
3434
/// </summary>
35-
[JsonPropertyName("excludeDomains")]
35+
[JsonPropertyName("blockingConfidence")]
3636
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
37-
public List<string> ? ExcludeDomains { get; set; }
37+
public PhishBlockThreshold ? BlockingConfidence { get; set; }
3838

3939
/// <summary>
40-
/// Optional. Sites with confidence level chosen &amp; above this value will be blocked from the
41-
/// search results.
40+
/// Optional. List of domains to be excluded from the search results. The default limit is 2000
41+
/// domains.
4242
/// </summary>
43-
[JsonPropertyName("blockingConfidence")]
43+
[JsonPropertyName("excludeDomains")]
4444
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
45-
public PhishBlockThreshold
46-
? BlockingConfidence {
45+
public List<string>
46+
? ExcludeDomains {
4747
get; set;
4848
}
4949

Google.GenAI/types/FileData.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@
2323

2424
namespace Google.GenAI.Types {
2525
/// <summary>
26-
/// URI based data.
26+
/// URI-based data. A FileData message contains a URI pointing to data of a specific media type.
27+
/// It is used to represent images, audio, and video stored in Google Cloud Storage.
2728
/// </summary>
2829

2930
public record FileData {
3031
/// <summary>
31-
/// Optional. Display name of the file data. Used to provide a label or filename to distinguish
32-
/// file datas. This field is only returned in PromptMessage for prompt management. It is
33-
/// currently used in the Gemini GenerateContent calls only when server side tools
34-
/// (code_execution, google_search, and url_context) are enabled. This field is not supported in
35-
/// Gemini API.
32+
/// Optional. The display name of the file. Used to provide a label or filename to distinguish
33+
/// files. This field is only returned in `PromptMessage` for prompt management. It is used in
34+
/// the Gemini calls only when server side tools (`code_execution`, `google_search`, and
35+
/// `url_context`) are enabled. This field is not supported in Gemini API.
3636
/// </summary>
3737
[JsonPropertyName("displayName")]
3838
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
3939
public string ? DisplayName { get; set; }
4040

4141
/// <summary>
42-
/// URI.
42+
/// The URI of the file in Google Cloud Storage.
4343
/// </summary>
4444
[JsonPropertyName("fileUri")]
4545
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]

Google.GenAI/types/FileSearch.cs

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// Auto-generated code. Do not edit.
18+
19+
using System;
20+
using System.Text.Json;
21+
using System.Text.Json.Serialization;
22+
using Google.GenAI.Serialization;
23+
24+
namespace Google.GenAI.Types {
25+
/// <summary>
26+
/// The FileSearch tool that retrieves knowledge from Semantic Retrieval corpora. Files are
27+
/// imported to Semantic Retrieval corpora using the ImportFile API. This data type is not
28+
/// supported in Vertex AI.
29+
/// </summary>
30+
31+
public record FileSearch {
32+
/// <summary>
33+
/// The names of the file_search_stores to retrieve from. Example:
34+
/// `fileSearchStores/my-file-search-store-123`
35+
/// </summary>
36+
[JsonPropertyName("fileSearchStoreNames")]
37+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
38+
public List<string> ? FileSearchStoreNames { get; set; }
39+
40+
/// <summary>
41+
/// Optional. Metadata filter to apply to the semantic retrieval documents and chunks.
42+
/// </summary>
43+
[JsonPropertyName("metadataFilter")]
44+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
45+
public string
46+
? MetadataFilter {
47+
get; set;
48+
}
49+
50+
/// <summary>
51+
/// Optional. The number of semantic retrieval chunks to retrieve.
52+
/// </summary>
53+
[JsonPropertyName("topK")]
54+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
55+
public int
56+
? TopK {
57+
get; set;
58+
}
59+
60+
/// <summary>
61+
/// Deserializes a JSON string to a FileSearch object.
62+
/// </summary>
63+
/// <param name="jsonString">The JSON string to deserialize.</param>
64+
/// <param name="options">Optional JsonSerializerOptions.</param>
65+
/// <returns>The deserialized FileSearch object, or null if deserialization fails.</returns>
66+
public static FileSearch ? FromJson(string jsonString, JsonSerializerOptions? options = null) {
67+
try {
68+
return JsonSerializer.Deserialize<FileSearch>(jsonString, options);
69+
} catch (JsonException e) {
70+
Console.Error.WriteLine($"Error deserializing JSON: {e.ToString()}");
71+
return null;
72+
}
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)