intelli_agent 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1af98056d1cfee93c37a849051ec08bbd94ff1b08e06c51df43459d0da2b39f
4
- data.tar.gz: 558d8b96efc731bb945d73a3d107a017147be910d57fcde9b9e84e0e20fcd42b
3
+ metadata.gz: 55a857044336782f57062c01ab7f1bed094698d47cf5c118d2e883f01c56134d
4
+ data.tar.gz: '098ef34bea5cfaa036ea484056d37f12cf849914c3593ad951f895e0113a1ff6'
5
5
  SHA512:
6
- metadata.gz: 1a59b52b56baea277a307efc5d9fa6b6f209292fec80842378001f2394084e1db3b2ee4e47d197aa75366e7da85b9941885566e67ccd26de03069f0a64582427
7
- data.tar.gz: a0779b693af7c7ac8856f1fae3dbdb91bb0ceceef1cb3e70c97b675dc47f1d60f22ece30e6447ff7a7a3ff9ed40abc99a96ce6768c169a2f3dbe6d81f3998e5e
6
+ metadata.gz: 201c21f58d7c5060ed8ac4a4dfd28349a6a1d0e61569eb9e7130d42572c299394668a7a3dc8b4b3b3af340e9ef77b6bbb4f315c563509434ceafc5fd86011b3b
7
+ data.tar.gz: f476bd10218da6111030b878793eb908070e3c3cff77f63c6b8082f9ac67486de83d3c7ef732dd5713a87b5633db0170fb90ab8b716aca149104e8c60a5b93ec
@@ -1,14 +1,14 @@
1
1
  # In the future, this became a bus to more than one AI provider
2
2
  module AI
3
- BASIC_MODEL = ENV.fetch('OPENAI_BASIC_MODEL')
4
- ADVANCED_MODEL = ENV.fetch('OPENAI_ADVANCED_MODEL')
3
+ BASIC_MODEL = 'gpt-4o-mini' # ENV.fetch('OPENAI_BASIC_MODEL')
4
+ ADVANCED_MODEL = 'gpt-4o' # ENV.fetch('OPENAI_ADVANCED_MODEL')
5
5
 
6
- def self.embed(input, model: 'text-embedding-3-large')
6
+ def embed(input, model: 'text-embedding-3-large')
7
7
  response = OpenAI::Client.new.embeddings(parameters: { input:, model: })
8
8
  response.dig('data', 0, 'embedding')
9
9
  end
10
10
 
11
- def self.single_prompt(prompt:, model: AI::BASIC_MODEL, response_format: nil)
11
+ def single_prompt(prompt:, model: AI::BASIC_MODEL, response_format: nil)
12
12
  parameters = { model:, messages: [{ role: 'user', content: prompt }] }
13
13
 
14
14
  parameters[:response_format] = { type: 'json_object' } if response_format.eql?(:json)
@@ -17,11 +17,11 @@ module AI
17
17
  response.dig('choices', 0, 'message', 'content').strip
18
18
  end
19
19
 
20
- def self.vision(prompt:, image_url:, response_format: nil)
20
+ def vision(prompt:, image_url:, model: AI::BASIC_MODEL, response_format: nil)
21
21
  messages = [{ type: :text, text: prompt },
22
22
  { type: :image_url, image_url: { url: image_url } }]
23
23
 
24
- parameters = { model: AI::ADVANCED_MODEL, messages: [{ role: :user, content: messages }] }
24
+ parameters = { model: model, messages: [{ role: :user, content: messages }] }
25
25
  parameters[:response_format] = { type: 'json_object' } if response_format.eql?(:json)
26
26
 
27
27
  response = OpenAI::Client.new.chat(parameters:)
@@ -29,7 +29,7 @@ module AI
29
29
  response.dig('choices', 0, 'message', 'content').strip
30
30
  end
31
31
 
32
- def self.single_chat(system:, user:, model: AI::BASIC_MODEL, response_format: nil)
32
+ def single_chat(system:, user:, model: AI::BASIC_MODEL, response_format: nil)
33
33
  parameters = { model:,
34
34
  messages: [
35
35
  { role: 'system', content: system },
@@ -42,7 +42,7 @@ module AI
42
42
  response.dig('choices', 0, 'message', 'content').strip
43
43
  end
44
44
 
45
- def self.chat(messages, model: AI::BASIC_MODEL, response_format: nil)
45
+ def chat(messages, model: AI::BASIC_MODEL, response_format: nil)
46
46
  parameters = { model:, messages: }
47
47
  parameters[:response_format] = { type: 'json_object' } if response_format.eql?(:json)
48
48
 
@@ -50,7 +50,7 @@ module AI
50
50
  response.dig('choices', 0, 'message', 'content').strip
51
51
  end
52
52
 
53
- def self.models
53
+ def models
54
54
  OpenAI::Client.new.models.list
55
55
  end
56
56
  end
data/lib/intelli_agent.rb CHANGED
@@ -1,4 +1,4 @@
1
- #require_relative './intelli_agent/ai'
1
+ require 'openai'
2
2
  require 'intelli_agent/ai'
3
3
 
4
4
  class IntelliAgent
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intelli_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gedean Dias