Module: QuickOpenAI
- Defined in:
- lib/quick_openai.rb,
lib/quick_openai/gpt3.rb,
lib/quick_openai/dalle2.rb,
lib/quick_openai/version.rb,
lib/quick_openai/extensions/string.rb
Defined Under Namespace
Modules: Dalle2, Extensions, Gpt3
Classes: Error
Constant Summary
collapse
- VERSION =
"0.1.3"
Class Method Summary
collapse
Class Method Details
.client ⇒ Object
12
13
14
|
# File 'lib/quick_openai.rb', line 12
def client
OpenAI::Client.new(access_token: ENV["OPENAI_ACCESS_TOKEN"])
end
|
.fetch_response_from_client ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/quick_openai.rb', line 16
def fetch_response_from_client
ensure_access_token!
begin
response = yield client
rescue StandardError
raise QuickOpenAI::Error, "Unable to fetch response."
end
ensure_no_error!(response)
response
end
|