Skip to content

Commit 12582dd

Browse files
[Firebase AI] Conform GroundingMetdata to Equatable (#15137)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 95570e5 commit 12582dd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

FirebaseAI/Sources/GenerateContentResponse.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ public struct PromptFeedback: Sendable {
310310
/// or Vertex AI Gemini API (see [Service Terms](https://cloud.google.com/terms/service-terms)
311311
/// section within the Service Specific Terms).
312312
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
313-
public struct GroundingMetadata: Sendable {
313+
public struct GroundingMetadata: Sendable, Equatable, Hashable {
314314
/// A list of web search queries that the model performed to gather the grounding information.
315315
/// These can be used to allow users to explore the search results themselves.
316316
public let webSearchQueries: [String]
@@ -327,7 +327,7 @@ public struct GroundingMetadata: Sendable {
327327

328328
/// A struct representing the Google Search entry point.
329329
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
330-
public struct SearchEntryPoint: Sendable {
330+
public struct SearchEntryPoint: Sendable, Equatable, Hashable {
331331
/// An HTML/CSS snippet that can be embedded in your app.
332332
///
333333
/// To ensure proper rendering, it's recommended to display this content within a `WKWebView`.
@@ -337,14 +337,14 @@ public struct GroundingMetadata: Sendable {
337337
/// Represents a chunk of retrieved data that supports a claim in the model's response. This is
338338
/// part of the grounding information provided when grounding is enabled.
339339
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
340-
public struct GroundingChunk: Sendable {
340+
public struct GroundingChunk: Sendable, Equatable, Hashable {
341341
/// Contains details if the grounding chunk is from a web source.
342342
public let web: WebGroundingChunk?
343343
}
344344

345345
/// A grounding chunk sourced from the web.
346346
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
347-
public struct WebGroundingChunk: Sendable {
347+
public struct WebGroundingChunk: Sendable, Equatable, Hashable {
348348
/// The URI of the retrieved web page.
349349
public let uri: String?
350350
/// The title of the retrieved web page.
@@ -358,7 +358,7 @@ public struct GroundingMetadata: Sendable {
358358
/// Provides information about how a specific segment of the model's response is supported by the
359359
/// retrieved grounding chunks.
360360
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
361-
public struct GroundingSupport: Sendable {
361+
public struct GroundingSupport: Sendable, Equatable, Hashable {
362362
/// Specifies the segment of the model's response content that this grounding support pertains
363363
/// to.
364364
public let segment: Segment
@@ -391,7 +391,7 @@ public struct GroundingMetadata: Sendable {
391391
/// Represents a specific segment within a ``ModelContent`` struct, often used to pinpoint the
392392
/// exact location of text or data that grounding information refers to.
393393
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
394-
public struct Segment: Sendable {
394+
public struct Segment: Sendable, Equatable, Hashable {
395395
/// The zero-based index of the ``Part`` object within the `parts` array of its parent
396396
/// ``ModelContent`` object. This identifies which part of the content the segment belongs to.
397397
public let partIndex: Int

0 commit comments

Comments
 (0)