Class: AssemblyAI::LemurClient
- Inherits:
-
Object
- Object
- AssemblyAI::LemurClient
- Defined in:
- lib/assemblyai/lemur/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#action_items(transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, answer_format: nil, request_options: nil) ⇒ AssemblyAI::Lemur::LemurActionItemsResponse
Use LeMUR to generate a list of action items from a transcript.
-
#get_response(request_id:, request_options: nil) ⇒ AssemblyAI::Lemur::LemurStringResponse, AssemblyAI::Lemur::LemurQuestionAnswerResponse
Retrieve a LeMUR response that was previously generated.
- #initialize(request_client:) ⇒ AssemblyAI::LemurClient constructor
-
#purge_request_data(request_id:, request_options: nil) ⇒ AssemblyAI::Lemur::PurgeLemurRequestDataResponse
Delete the data for a previously submitted LeMUR request.
-
#question_answer(questions:, transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, request_options: nil) ⇒ AssemblyAI::Lemur::LemurQuestionAnswerResponse
Question & Answer allows you to ask free-form questions about a single transcript or a group of transcripts.
-
#summary(transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, answer_format: nil, request_options: nil) ⇒ AssemblyAI::Lemur::LemurSummaryResponse
Custom Summary allows you to distill a piece of audio into a few impactful sentences.
-
#task(prompt:, transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, request_options: nil) ⇒ AssemblyAI::Lemur::LemurTaskResponse
Use the LeMUR task endpoint to input your own LLM prompt.
Constructor Details
#initialize(request_client:) ⇒ AssemblyAI::LemurClient
22 23 24 |
# File 'lib/assemblyai/lemur/client.rb', line 22 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ AssemblyAI::RequestClient (readonly)
18 19 20 |
# File 'lib/assemblyai/lemur/client.rb', line 18 def request_client @request_client end |
Instance Method Details
#action_items(transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, answer_format: nil, request_options: nil) ⇒ AssemblyAI::Lemur::LemurActionItemsResponse
Use LeMUR to generate a list of action items from a transcript
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/assemblyai/lemur/client.rb', line 203 def action_items(transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, answer_format: nil, request_options: nil) response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), transcript_ids: transcript_ids, input_text: input_text, context: context, final_model: final_model, max_output_size: max_output_size, temperature: temperature, answer_format: answer_format }.compact req.url "#{@request_client.get_url(request_options: )}/lemur/v3/generate/action-items" end AssemblyAI::Lemur::LemurActionItemsResponse.from_json(json_object: response.body) end |
#get_response(request_id:, request_options: nil) ⇒ AssemblyAI::Lemur::LemurStringResponse, AssemblyAI::Lemur::LemurQuestionAnswerResponse
Retrieve a LeMUR response that was previously generated.
237 238 239 240 241 242 243 244 245 |
# File 'lib/assemblyai/lemur/client.rb', line 237 def get_response(request_id:, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.url "#{@request_client.get_url(request_options: )}/lemur/v3/#{request_id}" end AssemblyAI::Lemur::LemurResponse.from_json(json_object: response.body) end |
#purge_request_data(request_id:, request_options: nil) ⇒ AssemblyAI::Lemur::PurgeLemurRequestDataResponse
Delete the data for a previously submitted LeMUR request.
The LLM response data, as well as any context provided in the original request
will be removed.
262 263 264 265 266 267 268 269 270 |
# File 'lib/assemblyai/lemur/client.rb', line 262 def purge_request_data(request_id:, request_options: nil) response = @request_client.conn.delete do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.url "#{@request_client.get_url(request_options: )}/lemur/v3/#{request_id}" end AssemblyAI::Lemur::PurgeLemurRequestDataResponse.from_json(json_object: response.body) end |
#question_answer(questions:, transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, request_options: nil) ⇒ AssemblyAI::Lemur::LemurQuestionAnswerResponse
Question & Answer allows you to ask free-form questions about a single
transcript or a group of transcripts.
The questions can be any whose answers you find useful, such as judging whether
a caller is likely to become a customer or whether all items on a meeting's
agenda were covered.
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/assemblyai/lemur/client.rb', line 156 def question_answer(questions:, transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, request_options: nil) response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), transcript_ids: transcript_ids, input_text: input_text, context: context, final_model: final_model, max_output_size: max_output_size, temperature: temperature, questions: questions }.compact req.url "#{@request_client.get_url(request_options: )}/lemur/v3/generate/question-answer" end AssemblyAI::Lemur::LemurQuestionAnswerResponse.from_json(json_object: response.body) end |
#summary(transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, answer_format: nil, request_options: nil) ⇒ AssemblyAI::Lemur::LemurSummaryResponse
Custom Summary allows you to distill a piece of audio into a few impactful
sentences.
You can give the model context to obtain more targeted results while outputting
the results in a variety of formats described in human language.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/assemblyai/lemur/client.rb', line 102 def summary(transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, answer_format: nil, request_options: nil) response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), transcript_ids: transcript_ids, input_text: input_text, context: context, final_model: final_model, max_output_size: max_output_size, temperature: temperature, answer_format: answer_format }.compact req.url "#{@request_client.get_url(request_options: )}/lemur/v3/generate/summary" end AssemblyAI::Lemur::LemurSummaryResponse.from_json(json_object: response.body) end |
#task(prompt:, transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, request_options: nil) ⇒ AssemblyAI::Lemur::LemurTaskResponse
Use the LeMUR task endpoint to input your own LLM prompt.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/assemblyai/lemur/client.rb', line 52 def task(prompt:, transcript_ids: nil, input_text: nil, context: nil, final_model: nil, max_output_size: nil, temperature: nil, request_options: nil) response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), transcript_ids: transcript_ids, input_text: input_text, context: context, final_model: final_model, max_output_size: max_output_size, temperature: temperature, prompt: prompt }.compact req.url "#{@request_client.get_url(request_options: )}/lemur/v3/generate/task" end AssemblyAI::Lemur::LemurTaskResponse.from_json(json_object: response.body) end |