webshaker 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b03ca48d3495f70d5097d85325b4ab917b4ff0217b6634fcc50a9649e7ffc5e
4
- data.tar.gz: 12925527140a41b0dd5e64a5551292a0fc97a7d42221bbe636d6517ec3d8d6ac
3
+ metadata.gz: e700f078decefd7d40b3469a5ae290c0746481a8d13f214c4020805b10660f20
4
+ data.tar.gz: 00cbe24e7355ba81e2d54dece6a1e2272e6aae8db52f929eae13053a1d5082b2
5
5
  SHA512:
6
- metadata.gz: 2e2bc1973b04b9fec176b7cde9aa07908c29b83a9ec074d25d983e5f2b025b60b84ce6635483566325222868224f598d07ce9a8e7d4d778873104f920a0369d8
7
- data.tar.gz: 88ac426fa0c12c9e2e2a45e2cf6ed23264402ef05c9be30f9cbd0b18c83caba46d38f26665197fb354161b7efb9fd692b8f0474928f990f8b613c0552f38ca6d
6
+ metadata.gz: 91082a99565064c4ad876d1b175024bfc5dc2a6291d16f2f22eb9613903eba3e34da16e196d0823e10547eaec9b2b9948c57835894e50d4adeaf18daa7adf2a5
7
+ data.tar.gz: 9d477bbd2420dd3a3b8c3938e26edd0a2c4e0f911743b41094d6991fae54931e2c768469cb3cb7e38b34ec84ef5fd04e54b02c40f522635c9aa6ffdd0710b51c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- webshaker (0.0.3)
4
+ webshaker (0.0.5)
5
5
  nokogiri
6
6
  ruby-openai
7
7
  selenium-webdriver (~> 4.0)
data/lib/webshaker/ai.rb CHANGED
@@ -6,22 +6,22 @@ module Webshaker
6
6
  @html_content = html_content
7
7
  end
8
8
 
9
- def analyze(with_prompt:, respond_with: :text, temperature: 0.8)
9
+ def analyze(with_prompt:, respond_with: :text, temperature: 0.8, full_response: false)
10
10
  response = ai_client.chat(
11
11
  parameters: {
12
12
  model: Webshaker.config.model,
13
13
  messages: messages(with_prompt).concat((respond_with.to_sym == :json) ? [{role: "user", content: "respond with json"}] : []),
14
14
  temperature:
15
15
  }.merge(
16
- (respond_with == :json) ? {response_format: {type: "json_object"}} : {}
16
+ (respond_with.to_sym == :json) ? {response_format: {type: "json_object"}} : {}
17
17
  )
18
18
  )
19
19
 
20
20
  # Return full response from the ai client if the respond_with is set to :full
21
- return response if respond_with === :full
21
+ return response if full_response
22
22
 
23
23
  response = response["choices"][0]["message"]["content"]
24
- response = JSON.parse(response) if respond_with === :json
24
+ response = JSON.parse(response) if respond_with.to_sym === :json
25
25
  response
26
26
  end
27
27
 
@@ -1,3 +1,3 @@
1
1
  module Webshaker
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webshaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Mochetti