Skip to content

Commit

Permalink
Make uri an optional parameter in CitationSources (google-gemini#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlazo authored and PatilShreyas committed Sep 21, 2024
1 parent 0782127 commit 520e450
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ constructor(@JsonNames("citations") val citationSources: List<CitationSources>)
data class CitationSources(
val startIndex: Int = 0,
val endIndex: Int,
val uri: String,
val uri: String? = null,
val license: String? = null,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ internal fun Part.toPublic(): com.google.ai.client.generativeai.type.Part {
}

internal fun CitationSources.toPublic() =
CitationMetadata(startIndex = startIndex, endIndex = endIndex, uri = uri, license = license)
CitationMetadata(startIndex = startIndex, endIndex = endIndex, uri = uri ?: "", license = license)

internal fun SafetyRating.toPublic() =
com.google.ai.client.generativeai.type.SafetyRating(category.toPublic(), probability.toPublic())
Expand Down

0 comments on commit 520e450

Please sign in to comment.