# Classes

The following declarations are available globally.
- `
  ### [AudioData](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/AudioData.md.txt)

  ` A wrapper class for input audio samples used in on-device machine learning using MediaPipe Task library.

  Internally this class uses a ring buffer to hold input audio data. Clients could feed input audio data via `load` method and access the aggregated audio samples via `buffer` property.

  Note that this class can only handle input audio in Float. TODO: Investigate if `AVAudioFormatInt32` should be supported. Only necessary if you can change the input format of `AVAudioEngine` or load audio files using `AVAudioFormatInt32`.

  #### Declaration

  Swift

      class AudioData: NSObject

- `
  ### [AudioDataFormat](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/AudioDataFormat.md.txt)

  ` Wraps properties describing the format of the incoming audio samples, namely number of channels and the sample rate.

  #### Declaration

  Swift

      class AudioDataFormat: NSObject

- `
  ### [AudioLoader](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/AudioLoader.md.txt)

  ` A utility class to load audio files from file paths on iOS.

  #### Declaration

  Swift

      class AudioLoader: NSObject

- `
  ### [AudioPart](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/AudioPart.md.txt)

  ` Audio part representing the audio content block of a multi-modal block.

  #### Declaration

  Swift

      class AudioPart: TaskPart

- `
  ### [AudioRecord](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/AudioRecord.md.txt)

  ` A wrapper class to record the device's microphone continuously. Currently this class only supports recording up to 2 channels. If the number of channels is 2, then the mono microphone input is duplicated to provide dual channel data.

  Internally the class manages an instance of `AVAudioEngine` for tapping the microphone samples.

  Recording sets the following parameters on the `AVAudioSession.sharedInstance()`:

  1. `category` = .playAndRecord 2. `mode` = .default 3. `categoryOptions` = \[.overrideMutedMicrophoneInterruption\]

  If you need more control, use the native `AVAudioEngine` directly for tapping the microphone. `AudioRecord` does not actively monitor audio interruptions, route changes, resetting of media services etc. They can be handled in the app using the notifications provided by `AVFAudio`. Refer to the official docs for the following: 1. Handling audio interruptions https://developer.apple.com/documentation/avfaudio/handling_audio_interruptions

  2. Responding to audio route changes https://developer.apple.com/documentation/avfaudio/responding_to_audio_route_change

  3. Responding to resetting of media services https://developer.apple.com/documentation/avfaudio/avaudiosessionmediaserviceswereresetnotification

  iOS may automatically stop the audio engine in some cases. A few examples of such events are a system interrupt, route change, etc. In such cases, `read(offset:length:)` returns `TasksErrorCode.audioRecordNotTappingMicError`. You can restart recording using `startRecording()`.

  Note: Avoid setting the `AVAudioSession.sharedInstance()` category, mode, options, channel configuration (enabling stereo) or other parameters while audio is being actively recorded using the audio record. Setting these parameters or changing the configuration of `AVAudioSession.sharedInstance()` while a recording is in progress will result in undefined behaviour.

  #### Declaration

  Swift

      class AudioRecord: NSObject

- `
  ### [BaseOptions](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/BaseOptions.md.txt)

  ` Holds the base options that is used for creation of any type of task. It has fields with important information acceleration configuration, TFLite model source etc.

  #### Declaration

  Swift

      class BaseOptions: NSObject, NSCopying

- `
  ### [DefaultTextChunker](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/DefaultTextChunker.md.txt)

  ` A default text chunking implementation using native C++ word-based chunking with overlap or character sliding window.

  #### Declaration

  Swift

      class DefaultTextChunker: NSObject, TextChunker

- `
  ### [Embedding](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/Embedding.md.txt)

  ` Represents the embedding for a given embedder head. Typically used in embedding tasks.

  One and only one of the two 'floatEmbedding' and 'quantizedEmbedding' will contain data, based on whether or not the embedder was configured to perform scala quantization.

  #### Declaration

  Swift

      class Embedding: NSObject

- `
  ### [EmbeddingResult](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/EmbeddingResult.md.txt)

  ` Represents the embedding results of a model. Typically used as a result for embedding tasks.

  #### Declaration

  Swift

      class EmbeddingResult: NSObject

- `
  ### [ImagePart](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/ImagePart.md.txt)

  ` Image part representing the image content block of a multi-modal block.

  #### Declaration

  Swift

      class ImagePart: TaskPart

- `
  ### [MPImage](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/MPImage.md.txt)

  ` An image used in on-device machine learning using MediaPipe Task library.

  #### Declaration

  Swift

      class MPImage: NSObject

- `
  ### [MPPFloatBuffer](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/MPPFloatBuffer.md.txt)

  ` A wrapper class to store pointer to a float array and its size.

  #### Declaration

  Swift

      class MPPFloatBuffer: NSObject, NSCopying

- `
  ### [RetrievalRecord](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/RetrievalRecord.md.txt)

  ` Represents a single record retrieved from the SemanticRetriever.

  #### Declaration

  Swift

      class RetrievalRecord: NSObject

- `
  ### [RetrievalResult](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/RetrievalResult.md.txt)

  ` Represents a single result retrieved from the SemanticRetriever, including similarity/relevance score.

  #### Declaration

  Swift

      class RetrievalResult: NSObject

- `
  ### [SemanticRetriever](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/SemanticRetriever.md.txt)

  ` Performs on-device semantic search, vector storage, and query retrieval on text, image, and audio files.

  #### Declaration

  Swift

      class SemanticRetriever: NSObject

- `
  ### [SemanticRetrieverComponents](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/SemanticRetrieverComponents.md.txt)

  ` A configuration container class for initializing `MPPSemanticRetriever`.

  #### Declaration

  Swift

      class SemanticRetrieverComponents: NSObject

- `
  ### [SqliteVectorStore](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/SqliteVectorStore.md.txt)

  ` A vector store implementation backed by SQLite database using native SQLite vector engine.

  #### Declaration

  Swift

      class SqliteVectorStore: NSObject, VectorStore

- `
  ### [TaskOptions](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/TaskOptions.md.txt)

  ` MediaPipe Tasks options base class. Any MediaPipe task-specific options class should extend this class.

  #### Declaration

  Swift

      class TaskOptions: NSObject, NSCopying

- `
  ### [TaskPart](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/TaskPart.md.txt)

  ` Represents a part of a multi-modal content block.

  #### Declaration

  Swift

      class TaskPart: NSObject

- `
  ### [TaskResult](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/TaskResult.md.txt)

  ` MediaPipe Tasks result base class. Any MediaPipe task result class should extend this class.

  #### Declaration

  Swift

      class TaskResult: NSObject, NSCopying

- `
  ### [TextPart](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/TextPart.md.txt)

  ` Text part representing the text content block of a multi-modal block.

  #### Declaration

  Swift

      class TextPart: TaskPart

- `
  ### [UniversalEmbedder](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/UniversalEmbedder.md.txt)

  ` Performs multi-modal embedding extraction on text, image, audio, or custom content blocks.

  This API wraps the native LiteRT-LM EmbeddingEngine directly, providing real on-device multimodal embeddings.

  #### Declaration

  Swift

      class UniversalEmbedder: NSObject, EmbeddingProvider

- `
  ### [UniversalEmbedderOptions](https://developers.google.com/edge/api/mediapipe/swift/retrieval/Classes/UniversalEmbedderOptions.md.txt)

  ` Options for setting up a `MPPUniversalEmbedder`.

  #### Declaration

  Swift

      class UniversalEmbedderOptions: TaskOptions, NSCopying