Skip to main content

Overview

The Suki Mobile SDK provides methods to check the processing status and retrieve the generated content of a session. You can use these methods to track the progress of your session and retrieve the generated content after it has been completed. The diagram below illustrates the process of retrieving the generated content of a session.
Before calling any of these methods, you must ensure that the SDK is initialized and that you are using a valid recordingId from an active or completed session.

Check Status And Retrieve Content

After you end a session, you can asynchronously check its processing status and retrieve the generated content. You must provide a valid recordingId for the session you want to query. All retrieval methods are asynchronous. The result is returned in a , which provides either the requested content or an error.

Check The Processing Status

Use the status(for:) method to get the current content generation status of a session.
SukiAmbientCore.shared.status(for: recordingId) { result in
    // The completion handler returns a result type.
    switch result {
    case .success(let status):
        // On success, the status object contains the current state.
        print("Session Status: \(status)")
    case .failure(let error):
        // On failure, an error object is returned.
        print("Error fetching status: \(error)")
    }
}

Get Generated Suggestions

To retrieve the main clinical note content, call the content(for:) method.
SukiAmbientCore.shared.content(for: recordingId) { result in
    switch result {
    case .success(let suggestions):
        // The suggestions object contains the generated note content.
        print("Generated Suggestions: \(suggestions)")
    case .failure(let error):
        print("Error fetching content: \(error)")
    }
}

Get The Audio Transcript

You can retrieve the full transcript of the conversation using the transcript(for:) method.
SukiAmbientCoreManager.shared.transcript(for: recordingId) { result in
    switch result {
    case .success(let response):
        // The response object contains transcript segments.
        // This example joins them into a single string.
        let transcriptText = (response.finalTranscript ?? []).compactMap { $0.transcript }.joined(separator: " ")
        print(transcriptText)
    case .failure(let error):
        print("Error fetching transcript: \(error)")
    }
}

Get Structured Data

Use the getStructuredData(for:) method to retrieve structured output, such as diagnoses and other entities generated from the session.
SukiAmbientCore.shared.getStructuredData(for: recordingId) { result in
    switch result {
    case .success(let structuredData):
        // The structuredData object contains generated entities.
        print("Structured Data: \(structuredData)")
    case .failure(let error):
        print("Error fetching structured data: \(error)")
    

Submit User Feedback

New You can now submit user feedback for the AI-generated content.
Use the submitFeedback(_:for:onCompletion:) to collect and submit user feedback on AI-generated content by using the QuantitativeFeedback and QualitativeFeedback structs. This allows you to capture both quantitative (ratings) and qualitative (comments) feedback. Your feedback helps Suki improve the quality of its AI-generated content.

Function Signature

public func submitFeedback(
    _ submission: FeedbackSubmission,
    for recordingId: RecordingId,
    onCompletion completionHandler: @escaping ((Result<String, Error>) -> Void)
)
public typealias RecordingId = String

Required Data Structures

Submitting feedback requires you to construct a FeedbackSubmission object. This object uses the FeedbackEntity and QuantitativeFeedback data structures.
public struct FeedbackSubmission {
    public let entity: FeedbackEntity
    public let quantitative: QuantitativeFeedback
    public let comments: String?
    
    public init(entity: FeedbackEntity,
                quantitative: QuantitativeFeedback,
                comments: String? = nil)
}

public enum FeedbackEntity: String {
    case content = "content"
}

public struct QuantitativeFeedback {
    public let minRating: Int
    public let maxRating: Int
    public let rating: Int
    
    public init(minRating: Int, maxRating: Int, rating: Int)
}

Implementation Example

To submit feedback, you first create the FeedbackSubmission object and then pass it to the submitFeedback method along with the recordingId. The method is asynchronous. The completion handler returns a Result containing either a success message with the unique feedbackId or an error if the submission failed.
// 1. Create the quantitative feedback object.
let quantitativeFeedback = QuantitativeFeedback(minRating: 1, maxRating: 5, rating: 4)

// 2. Create the full feedback submission object.
let submission = FeedbackSubmission(
    entity: .content,
    quantitative: quantitativeFeedback,
    comments: "The patient's history was captured accurately."
)

// 3. Call the submit method with the submission object and recording ID.
SukiAmbientCoreManager.shared.submitFeedback(submission, for: recordingId) { result in
    switch result {
    case .success(let feedbackId):
        print("Feedback submitted successfully with ID: \(feedbackId)")
    case .failure(let error):
        print("Error submitting feedback: \(error)")
    }
}
  • You can only provide feedback for each entity type once per session.
  • At present feedback submissions are only supported for the .content entity. This may be expanded in the future.
  • Submitting feedback for the same entity type a second time in the same session will be considered invalid.

Rating System

  • The maxRating must be greater than the minRating.
  • The rating must be within the inclusive range of minRating and maxRating.
  • The comments string is optional and has a maximum length of 2000 characters.
  • You can configure any integer rating scale. For example, you can create a 1 to 5 scale by setting minRating to 1 and maxRating to 5, or a binary scale by setting the values to 0 and 1.
  • Suki recommends using a scale of 1 to 5 for ratings.

FAQs

The content is not being generated because the session is not in a completed state or the session was too short. We require a minimum of 1 minute of audio to generate content. You must ensure that the session is in a completed state before retrieving the content.
The content is not being retrieved because the recordingId is not valid. You must ensure that you are using a valid recordingId from an active or completed session.
You can check the status of the session to determine if the content has been generated.
You can check the status of the session to determine if the content has been retrieved.
If the internet connection is lost, the content will be retrieved when the connection is restored. Please refer to the Offline Mode guide for more information.
The content will not be retrieved if the session is not completed. You must ensure that the session is in a completed state before retrieving the content.

Next Steps

After you have retrieved the content, you can proceed to the Clear Session guide to create a new session.
I