Sha256: fb4a592db08feb5c58ecccea6e7d412d192fa295251b5f479532ab56924dc031

Contents?: true

Size: 519 Bytes

Versions: 3

Compression:

Stored size: 519 Bytes

Contents

require "openai"

module Webshaker
  class Shaker
    attr_reader :url, :scrape_options

    def initialize(url, scrape_options = {})
      @url = url
      @scrape_options = scrape_options
    end

    def shake(with_prompt:, respond_with: :text, temperature: 0.8)
      ai.analyze(with_prompt:, respond_with: :text, temperature: 0.8)
    end

    private

    def html
      @html ||= Webshaker::Scraper.new(url, scrape_options).scrape.html
    end

    def ai
      @ai ||= Webshaker::Ai.new(html)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webshaker-0.0.5 lib/webshaker/shaker.rb
webshaker-0.0.4 lib/webshaker/shaker.rb
webshaker-0.0.3 lib/webshaker/shaker.rb