obscene_gpt 0.1.1 → 0.1.2

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: 6ef6875fbee1dd1d83f91a84405092e6a7c33bc5fdfcb41d539cb239d9620659
4
- data.tar.gz: 92ebe600ec5cda5c9631024246f5b9506388ee5414352d741c1a149605f8d46c
3
+ metadata.gz: '059e9f88337ce5353b70a7a58ca15c9c7962382cf4b532ba5fe59dca2977f11b'
4
+ data.tar.gz: ed809dd449d25cc46817e1ac6ded52d6a6b5a83fa530edd208bfb85a29d43c4d
5
5
  SHA512:
6
- metadata.gz: 2994590f0880cc27f53100e75fa4f06b237ca0f870de0f7e8ffe165c24684b23670d36c9ace1ad74811b4a2682a695c50b0afa8fcb878e6cf99c62859f63aa6f
7
- data.tar.gz: fa5f3e64135529d62b275f85c177db364702f5aa8822a4fd1d40373b6d9b53ed216ea42b1c01091bc3c3d194975a78661ef4ee00e380667e0d7023e1ddc987ec
6
+ metadata.gz: dadc5fab4cc61a074afe39ec58e86f67d5924b27415298a642ea1c2217b6b2d989586abcac84082eb628c385d14b5a744a7c3aa69a891f4d9c2cb7909650d042
7
+ data.tar.gz: 137094bbbfa37348eb386d06036029f14b4adf4d3d25e525be7184211f043d04fdd258a478f7e2ff476afde06a5ebc9276487140bafcbfe47f585ec339458c17
data/README.md CHANGED
@@ -38,6 +38,7 @@ export OPENAI_API_KEY="your-openai-api-key-here"
38
38
  ObsceneGpt.configure do |config|
39
39
  config.api_key = "your-openai-api-key-here"
40
40
  config.model = "gpt-4.1-nano"
41
+ config.request_timeout = 5 # Optional, defaults to 10 seconds
41
42
  end
42
43
  ```
43
44
 
@@ -10,7 +10,8 @@ module ObsceneGpt
10
10
  end
11
11
 
12
12
  class Configuration
13
- attr_accessor :api_key, :model, :schema, :prompt, :profanity_threshold, :test_mode, :test_detector_class
13
+ attr_accessor :api_key, :model, :schema, :prompt, :profanity_threshold, :test_mode,
14
+ :test_detector_class, :request_timeout
14
15
 
15
16
  def initialize
16
17
  @api_key = ENV.fetch("OPENAI_API_KEY", nil)
@@ -20,6 +21,7 @@ module ObsceneGpt
20
21
  @profanity_threshold = 0.8
21
22
  @test_mode = false
22
23
  @test_detector_class = TestDetector
24
+ @request_timeout = 10
23
25
  end
24
26
  end
25
27
  end
@@ -5,10 +5,13 @@ module ObsceneGpt
5
5
  class Detector
6
6
  attr_reader :client, :model, :schema, :prompt
7
7
 
8
- def initialize(api_key: nil, model: nil, schema: nil, prompt: nil)
8
+ def initialize(api_key: nil, model: nil, schema: nil, prompt: nil, request_timeout: nil)
9
9
  api_key ||= ObsceneGpt.configuration.api_key
10
10
 
11
- @client = OpenAI::Client.new(access_token: api_key)
11
+ @client = OpenAI::Client.new(
12
+ access_token: api_key,
13
+ request_timeout: request_timeout || ObsceneGpt.configuration.request_timeout,
14
+ )
12
15
  @model = model || ObsceneGpt.configuration.model
13
16
  @schema = schema || ObsceneGpt.configuration.schema
14
17
  @prompt = prompt || ObsceneGpt.configuration.prompt
@@ -1,3 +1,3 @@
1
1
  module ObsceneGpt
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obscene_gpt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Perez