Use the Ruby SDK with Fun-ASR-Flash to transcribe a local recording and print the recognized text.
Prerequisites
Install the Ruby SDK and configure your API key. Replace WorkspaceId with your workspace ID in Singapore and use an API key from the same region.
Quick start
Save the example as example.rb and run ruby example.rb.
SDK reference
| Option | Description |
|---|---|
url, http_timeout | HTTPS endpoint and HTTP timeout in seconds. |
model, audio | Model ID and audio input in the request. |
format, sample_rate | Audio format and sample rate. Set the actual sample rate for raw PCM. |
transcribe waits for the final sentence. To read intermediate results, call transcribe_streaming and read text and sentence from each Result.
Pass a file path in audio. This example uses WAV. See the model API reference for other audio formats and limits.