-
Notifications
You must be signed in to change notification settings - Fork 50
[Firebase AI] Add Thought summaries #1317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,6 +234,20 @@ public static ModelContent ConvertToModel(this ModelContent content) { | |
public static ModelContent ConvertToSystem(this ModelContent content) { | ||
return content.ConvertRole("system"); | ||
} | ||
|
||
public static void AddIfHasValue<T>(this JsonDict jsonDict, string key, | ||
T? value) where T : struct { | ||
if (value.HasValue) { | ||
jsonDict.Add(key, value.Value); | ||
} | ||
} | ||
|
||
public static void AddIfHasValue<T>(this JsonDict jsonDict, string key, | ||
T value) where T : class { | ||
if (value != null) { | ||
jsonDict.Add(key, value); | ||
} | ||
} | ||
Comment on lines
+238
to
+250
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why we would need to functions, the only difference I can find is the ? after T in parameters There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default, struct's are not-nullable, which is why I need the version with T?, and retrieve the underlying value with .Value. Classes can be null, and by default doing T? with a class will result in a warning. So doing two methods helps prevent that warning. |
||
} | ||
|
||
} |
Uh oh!
There was an error while loading. Please reload this page.