Ted Hisokawa
Aug 13, 2024 04:37
AssemblyAI has launched a Ruby SDK, enabling customers to transcribe audio, use audio intelligence fashions, and apply LLMs to audio knowledge.
AssemblyAI has unveiled its newest providing, the Ruby SDK, geared toward simplifying the method of using superior speech AI fashions. In line with AssemblyAI, this new SDK permits builders to transcribe audio, leverage audio intelligence fashions, and apply Giant Language Fashions (LLMs) to their audio knowledge utilizing LeMUR.
Transcribing Audio Information
The Ruby SDK offers an environment friendly option to transcribe audio recordsdata. Customers can transcribe each distant and native audio recordsdata by following easy code snippets. As an illustration, to transcribe a distant audio file, customers can use the next code:
require 'assemblyai'
shopper = AssemblyAI::Shopper.new(api_key: 'YOUR_API_KEY')
transcript = shopper.transcripts.transcribe(
audio_url: 'https://storage.googleapis.com/aai-docs-samples/nbc.mp3'
)
abort transcript.error if transcript.standing == AssemblyAI::Transcripts::TranscriptStatus::ERROR
places transcript.textual content
Equally, native recordsdata will be transcribed by first importing the file after which processing it:
uploaded_file = shopper.recordsdata.add(file: '/path/to/your/file')
transcript = shopper.transcripts.transcribe(
audio_url: uploaded_file.upload_url
)
Detailed directions for transcribing audio recordsdata can be found within the AssemblyAI documentation.
Making use of LLMs to Audio Information with LeMUR
The Ruby SDK additionally helps the appliance of LLMs to audio knowledge utilizing LeMUR. Customers can construct functions that summarize transcripts or carry out different duties:
response = shopper.lemur.activity(
transcript_ids: [transcript.id],
immediate: 'Summarize this transcript.'
)
places response.response
Extra data on utilizing LLMs with audio knowledge will be discovered within the AssemblyAI documentation.
Using Audio Intelligence Fashions
One other key function of the Ruby SDK is its functionality to make use of audio intelligence fashions. These fashions can analyze audio recordsdata for numerous attributes, similar to sentiment evaluation:
transcript = shopper.transcripts.transcribe(
audio_url: 'https://storage.googleapis.com/aai-docs-samples/nbc.mp3',
sentiment_analysis: true
)
abort transcript.error if transcript.standing == AssemblyAI::Transcripts::TranscriptStatus::ERROR
transcript.sentiment_analysis_results.every do |consequence|
places consequence.textual content
places consequence.sentiment
places consequence.confidence
printf("%d - %dn", begin: consequence.begin, finish: consequence.end_)
finish
Further particulars on audio intelligence fashions can be found within the AssemblyAI documentation.
Getting Began with the Ruby SDK
To start utilizing the Ruby SDK, builders can consult with the set up directions and the README of the Ruby SDK GitHub repository. For any points or suggestions, customers are inspired to file a problem on the GitHub repository.
Picture supply: Shutterstock