recognizeSpeechRemote
Import
import {
PassioSDK,
type PassioSpeechRecognitionModel,
type PassioFoodDataInfo,
} from '@passiolife/nutritionai-react-native-sdk-v3'
/**
* @param text - Provide `text` to get `PassioSpeechRecognitionModel` list detail.
* @returns A `Promise` resolving to `PassioSpeechRecognitionModel` list.
*/
recognizeSpeechRemote(
text: string
): Promise<PassioSpeechRecognitionModel[] | null>
Example
It's return PassioSpeechRecognitionModel[]
const recognizeSpeech = useCallback(
async (text: string) => {
try {
// Fetch food results from the PassioSDK based on the query
const recognizedModel = await PassioSDK.recognizeSpeechRemote(text)
setPassioSpeechRecognitionModel(recognizedModel)
} catch (error) {
// Handle errors, e.g., network issues or API failures
} finally {
// Reset loading state to indicate the end of the search
}
},
[cleanSearch]
)
Last updated