Class: OxAiWorkers::Request

Inherits:
ModuleRequest show all
Defined in:
lib/oxaiworkers/request.rb

Instance Attribute Summary

Attributes inherited from ModuleRequest

#client, #custom_id, #errors, #max_tokens, #messages, #model, #result, #temperature, #tool_calls, #tool_calls_raw, #tools

Instance Method Summary collapse

Methods inherited from ModuleRequest

#append, #cleanup, #initialize_requests, #not_found_is_ok, #params, #parse_choices

Instance Method Details

#completed?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/oxaiworkers/request.rb', line 21

def completed?
  @result.present? or @errors.present? or @tool_calls.present?
end

#finishObject



7
8
9
10
# File 'lib/oxaiworkers/request.rb', line 7

def finish
  @custom_id = SecureRandom.uuid
  cleanup
end

#request!Object



12
13
14
15
# File 'lib/oxaiworkers/request.rb', line 12

def request!
  response = @client.chat(parameters: params)
  parse_choices(response)
end

#requested?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/oxaiworkers/request.rb', line 17

def requested?
  false
end