Module: AskChatgpt

Extended by:
AskChatGPT::Console
Defined in:
lib/ask_chatgpt/executor.rb,
lib/ask_chatgpt.rb,
lib/ask_chatgpt/sugar.rb,
lib/ask_chatgpt/voice.rb,
lib/ask_chatgpt/console.rb,
lib/ask_chatgpt/helpers.rb,
lib/ask_chatgpt/railtie.rb,
lib/ask_chatgpt/version.rb,
lib/ask_chatgpt/prompts/app.rb,
lib/ask_chatgpt/prompts/base.rb,
lib/ask_chatgpt/prompts/model.rb,
lib/ask_chatgpt/prompts/custom.rb,
lib/ask_chatgpt/prompts/explain.rb,
lib/ask_chatgpt/prompts/improve.rb,
lib/ask_chatgpt/default_behavior.rb,
lib/ask_chatgpt/prompts/find_bug.rb,
lib/ask_chatgpt/prompts/question.rb,
lib/ask_chatgpt/prompts/refactor.rb,
lib/ask_chatgpt/prompts/unit_test.rb,
lib/ask_chatgpt/prompts/with_code.rb,
lib/ask_chatgpt/prompts/random_tip.rb,
lib/ask_chatgpt/prompts/rspec_test.rb,
lib/ask_chatgpt/prompts/code_review.rb

Overview

Defined Under Namespace

Modules: Console, DefaultBehavior, Prompts, Sugar, VoiceFlow Classes: Executor, Helpers, InputError, Railtie

Constant Summary collapse

VERSION =
"0.6.1"
@@mode =

or :sync

:async
@@markdown =
true
@@debug =
false
@@model =
"gpt-3.5-turbo"
@@temperature =
0.1
@@max_tokens =
nil
@@access_token =
ENV["OPENAI_API_KEY"]
@@included_prompts =
[AskChatGPT::Prompts::App.new]
@@audio_device_id =
nil
@@voice_max_duration =

10 seconds

10

Class Method Summary collapse

Class Method Details

.register_prompt(name, &block) ⇒ Object



71
72
73
74
75
76
77
78
79
# File 'lib/ask_chatgpt.rb', line 71

def self.register_prompt(name, &block)
  # i want to create a module and include it into a class, with method name and code from block
  AskChatGPT::Executor.class_eval do
    define_method(name) do |*args|
      @scope << AskChatGPT::Prompts::Custom.new(*args, block)
      self
    end
  end
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (AskChatgpt)

    the object that the method was called on



67
68
69
# File 'lib/ask_chatgpt.rb', line 67

def self.setup
  yield(self)
end