MediaPipeTasksRetrieval Framework Reference

VectorStore

protocol VectorStore

Storage backend for vector embeddings, multimodal part handles, and record metadata.

  • Deletes all records matching ids, along with any associated child rows.

    Declaration

    Swift

    func delete(ids: [String]) throws
  • Deletes all records matching every metadataFilter pair, along with associated child rows.

    Declaration

    Swift

    func delete(metadataFilter: [String: String]) throws
  • Deletes every record in the store.

    Declaration

    Swift

    func deleteAllRecords() throws
  • Returns the stored record matching id, or nil if not found.

    Declaration

    Swift

    func record(id: String) throws -> RetrievalRecord?
  • Returns the stored record matching id, or nil if not found.

    Declaration

    Swift

    func record(id: String) throws -> RetrievalRecord?
  • Returns all top-level record identifiers in the store (excluding child chunk or part rows).

    Declaration

    Swift

    func recordIdentifiers() throws -> [String]
  • Returns all stored records matching ids.

    Declaration

    Swift

    func records(ids: [String]) throws -> [RetrievalRecord]
  • Searches for up to limit nearest records with a minimum similarity threshold of 0.

    Declaration

    Swift

    func search(embedding: [Float], limit: Int = 5, metadataFilter: [String: String]? = nil) throws -> [RetrievalRecord]
  • Searches for up to limit nearest records whose similarity is at least minSimilarity.

    Declaration

    Swift

    func search(embedding: [Float], limit: Int = 5, minSimilarity: Float) throws -> [RetrievalRecord]
  • Searches for up to limit records whose similarity to embedding is at least minSimilarity, optionally restricted to records matching every metadataFilter pair.

    Declaration

    Swift

    func search(embedding: [Float], limit: Int, minSimilarity: Float, metadataFilter: [String: String]?) throws -> [RetrievalRecord]
  • Searches for up to 5 nearest records matching minSimilarity and metadataFilter.

    Declaration

    Swift

    func search(embedding: [Float], minSimilarity: Float, metadataFilter: [String: String]?) throws -> [RetrievalRecord]
  • Inserts or replaces records in the store.

    Declaration

    Swift

    func upsertRecords(_ records: [RetrievalRecord]) throws