openaiext 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/openaiext.rb +15 -5
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa387e4a2018bbe15a88f28a24d55aefe1b69d722fe060abf4700f85fa2c1e1b
4
- data.tar.gz: c2ae11b8a9287fdabfebde0e97f5d6c20ffc0fc91728bea6bdfcc0ed0ac7c1c1
3
+ metadata.gz: 001ae93d35a8aa13a2e2fe167e027849068c67e3b67e5691b0a1486ba32038b1
4
+ data.tar.gz: 4bee70a359b8b751a02cb293c0a200bb2775e303e2f96914bec7b8dd42bf3733
5
5
  SHA512:
6
- metadata.gz: 1d8bd813c1f19c6f3940216a800cf9647df431c198516bbbf31d17f2e784b55f28df1b7d33b92cbdae0271e75f194b623fffe0e2967a9c9f669b988690883bbb
7
- data.tar.gz: 705d4a98839780cd4ae56f419c241c0e85645620c385634250d69685f861631950f12ba4bbf6f584510534b3b32965dc8adc663a0f77d30762fdb9a499e78674
6
+ metadata.gz: 25aacf4d31e2919c1d5e09d5c25335e29dfc2b0823b14e53087d26fa1172d5bd3671eb2006ec2c218220062328c4e51999d580bc0999c7732b2cf24c96ea8dd7
7
+ data.tar.gz: 97330fe2fc52929de29f8fb13dd46d2831e1b6a28761997552731f9a9abb87957504f36241ea83d7f6cdebe37891dafe45065494f0f1b4ab3029303b1f4088dd
data/lib/openaiext.rb CHANGED
@@ -19,15 +19,15 @@ module OpenAIExt
19
19
  chat(messages: [{ role: :user, content: message_content }], model:, response_format:, max_tokens:, store:, tools:, auto_run_functions:, function_context:)
20
20
  end
21
21
 
22
- def self.single_prompt(prompt:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, store: true, metadata: nil, tools: nil, auto_run_functions: false, function_context: nil, temperature: nil, top_p: nil, frequency_penalty: nil, presence_penalty: nil)
23
- chat(messages: [{ user: prompt }], model:, response_format:, max_tokens:, store:, tools:, auto_run_functions:, function_context:, temperature:, top_p:, frequency_penalty:, presence_penalty:)
22
+ def self.single_prompt(prompt:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, store: true, metadata: nil, tools: nil, auto_run_functions: false, function_context: nil, temperature: nil, top_p: nil, frequency_penalty: nil, presence_penalty: nil, prediction: nil)
23
+ chat(messages: [{ user: prompt }], model:, response_format:, max_tokens:, store:, tools:, auto_run_functions:, function_context:, temperature:, top_p:, frequency_penalty:, presence_penalty:, prediction:)
24
24
  end
25
25
 
26
- def self.single_chat(system:, user:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, store: true, metadata: nil, tools: nil, auto_run_functions: false, function_context: nil, temperature: nil, top_p: nil, frequency_penalty: nil, presence_penalty: nil)
27
- chat(messages: [{ system: }, { user: }], model:, response_format:, max_tokens:, store:, tools:, auto_run_functions:, function_context:, temperature:, top_p:, frequency_penalty:, presence_penalty:)
26
+ def self.single_chat(system:, user:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, store: true, metadata: nil, tools: nil, auto_run_functions: false, function_context: nil, temperature: nil, top_p: nil, frequency_penalty: nil, presence_penalty: nil, prediction: nil)
27
+ chat(messages: [{ system: }, { user: }], model:, response_format:, max_tokens:, store:, tools:, auto_run_functions:, function_context:, temperature:, top_p:, frequency_penalty:, presence_penalty:, prediction:)
28
28
  end
29
29
 
30
- def self.chat(messages:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, store: true, metadata: nil, tools: nil, auto_run_functions: false, function_context: nil, temperature: nil, top_p: nil, frequency_penalty: nil, presence_penalty: nil)
30
+ def self.chat(messages:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, store: true, metadata: nil, tools: nil, auto_run_functions: false, function_context: nil, temperature: nil, top_p: nil, frequency_penalty: nil, presence_penalty: nil, prediction: nil)
31
31
  model = OpenAIExt::Model.select(model)
32
32
  is_o1_model = model.start_with?('o1')
33
33
 
@@ -47,6 +47,7 @@ module OpenAIExt
47
47
  parameters[:top_p] = top_p if top_p
48
48
  parameters[:frequency_penalty] = frequency_penalty if frequency_penalty
49
49
  parameters[:presence_penalty] = presence_penalty if presence_penalty
50
+ parameters[:prediction] = prediction if prediction
50
51
 
51
52
  begin
52
53
  response = OpenAI::Client.new.chat(parameters:)
@@ -69,4 +70,13 @@ module OpenAIExt
69
70
  end
70
71
 
71
72
  def self.models = OpenAI::Client.new.models.list
73
+
74
+ def self.load_config
75
+ OpenAI.configure do |config|
76
+ config.access_token = ENV.fetch('OPENAI_ACCESS_TOKEN')
77
+ config.organization_id = ENV.fetch('OPENAI_ORGANIZATION_ID')
78
+ config.request_timeout = 300
79
+ config.log_errors = true
80
+ end
81
+ end
72
82
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openaiext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gedean Dias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-13 00:00:00.000000000 Z
11
+ date: 2024-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-openai
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubygems_version: 3.5.22
72
+ rubygems_version: 3.5.23
73
73
  signing_key:
74
74
  specification_version: 4
75
75
  summary: Ruby OpenAI Extended