Skip to content

Commit 4d3fcaa

Browse files
authored
[FirebaseAI] Fix minor issues with reference docs (#1251)
* [FirebaseAI] Fix minor issues with reference docs * Update ResponseModality.cs * Update CMakeLists.txt
1 parent a3c725b commit 4d3fcaa

10 files changed

+93
-26
lines changed

firebaseai/src/Candidate.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ public readonly struct Candidate {
8383
/// <summary>
8484
/// The safety rating of the response content.
8585
/// </summary>
86-
public IEnumerable<SafetyRating> SafetyRatings =>
87-
_safetyRatings ?? new ReadOnlyCollection<SafetyRating>(new List<SafetyRating>());
86+
public IEnumerable<SafetyRating> SafetyRatings {
87+
get {
88+
return _safetyRatings ?? new ReadOnlyCollection<SafetyRating>(new List<SafetyRating>());
89+
}
90+
}
8891

8992
/// <summary>
9093
/// The reason the model stopped generating content, if it exists;

firebaseai/src/Chat.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ public class Chat {
3636
/// The previous content from the chat that has been successfully sent and received from the
3737
/// model. This will be provided to the model for each message sent as context for the discussion.
3838
/// </summary>
39-
public IEnumerable<ModelContent> History => new ReadOnlyCollection<ModelContent>(chatHistory);
39+
public IEnumerable<ModelContent> History {
40+
get {
41+
return new ReadOnlyCollection<ModelContent>(chatHistory);
42+
}
43+
}
4044

4145
// Note: No public constructor, get one through GenerativeModel.StartChat
4246
private Chat(GenerativeModel model, IEnumerable<ModelContent> initialHistory) {

firebaseai/src/Citation.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ public readonly struct CitationMetadata {
3030
/// <summary>
3131
/// A list of individual cited sources and the parts of the content to which they apply.
3232
/// </summary>
33-
public IEnumerable<Citation> Citations =>
34-
_citations ?? new ReadOnlyCollection<Citation>(new List<Citation>());
33+
public IEnumerable<Citation> Citations {
34+
get {
35+
return _citations ?? new ReadOnlyCollection<Citation>(new List<Citation>());
36+
}
37+
}
3538

3639
// Hidden constructor, users don't need to make this.
3740
private CitationMetadata(List<Citation> citations) {

firebaseai/src/CountTokensResponse.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ public readonly struct CountTokensResponse {
4141
/// <summary>
4242
/// The breakdown, by modality, of how many tokens are consumed by the prompt.
4343
/// </summary>
44-
public IEnumerable<ModalityTokenCount> PromptTokensDetails =>
45-
_promptTokensDetails ?? new ReadOnlyCollection<ModalityTokenCount>(new List<ModalityTokenCount>());
44+
public IEnumerable<ModalityTokenCount> PromptTokensDetails {
45+
get {
46+
return _promptTokensDetails ?? new ReadOnlyCollection<ModalityTokenCount>(new List<ModalityTokenCount>());
47+
}
48+
}
4649

4750
// Hidden constructor, users don't need to make this
4851
private CountTokensResponse(int totalTokens,

firebaseai/src/FirebaseAI.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ private FirebaseAI(FirebaseApp firebaseApp, Backend backend) {
9393
/// <summary>
9494
/// Returns a `FirebaseAI` instance with the default `FirebaseApp` and GoogleAI Backend.
9595
/// </summary>
96-
public static FirebaseAI DefaultInstance => GetInstance();
96+
public static FirebaseAI DefaultInstance {
97+
get {
98+
return GetInstance();
99+
}
100+
}
97101

98102
/// <summary>
99103
/// Returns a `FirebaseAI` instance with the default `FirebaseApp` and the given Backend.

firebaseai/src/GenerateContentResponse.cs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ public readonly struct GenerateContentResponse {
3131
/// <summary>
3232
/// A list of candidate response content, ordered from best to worst.
3333
/// </summary>
34-
public IEnumerable<Candidate> Candidates =>
35-
_candidates ?? new ReadOnlyCollection<Candidate>(new List<Candidate>());
34+
public IEnumerable<Candidate> Candidates {
35+
get {
36+
return _candidates ?? new ReadOnlyCollection<Candidate>(new List<Candidate>());
37+
}
38+
}
3639

3740
/// <summary>
3841
/// A value containing the safety ratings for the response, or,
@@ -141,8 +144,11 @@ public readonly struct PromptFeedback {
141144
/// <summary>
142145
/// The safety ratings of the prompt.
143146
/// </summary>
144-
public IEnumerable<SafetyRating> SafetyRatings =>
145-
_safetyRatings ?? new ReadOnlyCollection<SafetyRating>(new List<SafetyRating>());
147+
public IEnumerable<SafetyRating> SafetyRatings {
148+
get {
149+
return _safetyRatings ?? new ReadOnlyCollection<SafetyRating>(new List<SafetyRating>());
150+
}
151+
}
146152

147153
// Hidden constructor, users don't need to make this.
148154
private PromptFeedback(BlockReason? blockReason, string blockReasonMessage,
@@ -192,12 +198,18 @@ public readonly struct UsageMetadata {
192198
public int TotalTokenCount { get; }
193199

194200
private readonly ReadOnlyCollection<ModalityTokenCount> _promptTokensDetails;
195-
public IEnumerable<ModalityTokenCount> PromptTokensDetails =>
196-
_promptTokensDetails ?? new ReadOnlyCollection<ModalityTokenCount>(new List<ModalityTokenCount>());
201+
public IEnumerable<ModalityTokenCount> PromptTokensDetails {
202+
get {
203+
return _promptTokensDetails ?? new ReadOnlyCollection<ModalityTokenCount>(new List<ModalityTokenCount>());
204+
}
205+
}
197206

198207
private readonly ReadOnlyCollection<ModalityTokenCount> _candidatesTokensDetails;
199-
public IEnumerable<ModalityTokenCount> CandidatesTokensDetails =>
200-
_candidatesTokensDetails ?? new ReadOnlyCollection<ModalityTokenCount>(new List<ModalityTokenCount>());
208+
public IEnumerable<ModalityTokenCount> CandidatesTokensDetails {
209+
get {
210+
return _candidatesTokensDetails ?? new ReadOnlyCollection<ModalityTokenCount>(new List<ModalityTokenCount>());
211+
}
212+
}
201213

202214
// Hidden constructor, users don't need to make this.
203215
private UsageMetadata(int promptTC, int candidatesTC, int totalTC,

firebaseai/src/LiveSessionResponse.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,12 @@ internal static LiveSessionContent FromJson(Dictionary<string, object> jsonDict)
183183
///
184184
/// This will be empty if no function calls are present.
185185
/// </summary>
186-
public IEnumerable<ModelContent.FunctionCallPart> FunctionCalls =>
187-
_functionCalls ?? new ReadOnlyCollection<ModelContent.FunctionCallPart>(
186+
public IEnumerable<ModelContent.FunctionCallPart> FunctionCalls {
187+
get {
188+
return _functionCalls ?? new ReadOnlyCollection<ModelContent.FunctionCallPart>(
188189
new List<ModelContent.FunctionCallPart>());
190+
}
191+
}
189192

190193
private LiveSessionToolCall(List<ModelContent.FunctionCallPart> functionCalls) {
191194
_functionCalls = new ReadOnlyCollection<ModelContent.FunctionCallPart>(
@@ -211,8 +214,11 @@ internal static LiveSessionToolCall FromJson(Dictionary<string, object> jsonDict
211214
/// <summary>
212215
/// The list of Function IDs to cancel.
213216
/// </summary>
214-
public IEnumerable<string> FunctionIds =>
215-
_functionIds ?? new ReadOnlyCollection<string>(new List<string>());
217+
public IEnumerable<string> FunctionIds {
218+
get {
219+
return _functionIds ?? new ReadOnlyCollection<string>(new List<string>());
220+
}
221+
}
216222

217223
private LiveSessionToolCallCancellation(List<string> functionIds) {
218224
_functionIds = new ReadOnlyCollection<string>(

firebaseai/src/ModelContent.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,20 @@ public readonly struct ModelContent {
3535
/// The role of the entity creating the `ModelContent`. For user-generated client requests,
3636
/// for example, the role is `user`.
3737
/// </summary>
38-
public string Role => string.IsNullOrWhiteSpace(_role) ? "user" : _role;
38+
public string Role {
39+
get {
40+
return string.IsNullOrWhiteSpace(_role) ? "user" : _role;
41+
}
42+
}
3943

4044
/// <summary>
4145
/// The data parts comprising this `ModelContent` value.
4246
/// </summary>
43-
public IEnumerable<Part> Parts => _parts ?? new ReadOnlyCollection<Part>(new List<Part>());
47+
public IEnumerable<Part> Parts {
48+
get {
49+
return _parts ?? new ReadOnlyCollection<Part>(new List<Part>());
50+
}
51+
}
4452

4553
/// <summary>
4654
/// Creates a `ModelContent` with the given `Part`s, using the default `user` role.

firebaseai/src/ResponseModality.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,32 @@ namespace Firebase.AI {
2020
/// The response type the model should return with.
2121
/// </summary>
2222
public enum ResponseModality {
23+
/// <summary>
24+
/// Specifies that the model should generate textual content.
25+
///
26+
/// Use this modality when you need the model to produce written language, such as answers to
27+
/// questions, summaries, creative writing, code snippets, or structured data formats like JSON.
28+
/// </summary>
2329
Text,
30+
/// <summary>
31+
/// **Public Experimental**: Specifies that the model should generate image data.
32+
///
33+
/// Use this modality when you want the model to create visual content based on the provided input
34+
/// or prompts. The response might contain one or more generated images. See the [image
35+
/// generation](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal-response-generation#image-generation)
36+
/// documentation for more details.
37+
///
38+
/// > Warning: Image generation using Gemini 2.0 Flash is a **Public Experimental** feature, which
39+
/// > means that it is not subject to any SLA or deprecation policy and could change in
40+
/// > backwards-incompatible ways.
41+
/// </summary>
2442
Image,
43+
/// <summary>
44+
/// **Public Experimental**: Specifies that the model should generate audio data.
45+
///
46+
/// Use this modality with a `LiveGenerationConfig` to create audio content based on the
47+
/// provided input or prompts with a `LiveGenerativeModel`.
48+
/// </summary>
2549
Audio,
2650
}
2751

firebaseai/src/Schema.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public static StringFormat Custom(string format) {
100100
/// <summary>
101101
/// Possible values of the element of type "String" with "enum" format.
102102
/// </summary>
103-
public IEnumerable<string> EnumValues => _enumValues;
103+
public IEnumerable<string> EnumValues { get { return _enumValues; } }
104104
/// <summary>
105105
/// Schema of the elements of type "Array".
106106
/// </summary>
@@ -132,7 +132,7 @@ public static StringFormat Custom(string format) {
132132
/// <summary>
133133
/// Required properties of type "Object".
134134
/// </summary>
135-
public IEnumerable<string> RequiredProperties => _requiredProperties;
135+
public IEnumerable<string> RequiredProperties { get { return _requiredProperties; } }
136136

137137
private readonly ReadOnlyCollection<string> _propertyOrdering;
138138
/// <summary>
@@ -143,7 +143,7 @@ public static StringFormat Custom(string format) {
143143
/// not preserve this order. This parameter primarily affects the raw JSON string
144144
/// serialization.
145145
/// </summary>
146-
public IEnumerable<string> PropertyOrdering => _propertyOrdering;
146+
public IEnumerable<string> PropertyOrdering { get { return _propertyOrdering; } }
147147

148148
private readonly ReadOnlyCollection<Schema> _anyOf;
149149
/// <summary>
@@ -156,7 +156,7 @@ public static StringFormat Custom(string format) {
156156
/// Schema.AnyOf(new [] { Schema.String(), Schema.Int() })
157157
/// ```
158158
/// </summary>
159-
public IEnumerable<Schema> AnyOfSchemas => _anyOf;
159+
public IEnumerable<Schema> AnyOfSchemas { get { return _anyOf; } }
160160

161161
private Schema(
162162
SchemaType? type,

0 commit comments

Comments
 (0)