intelli_agent 0.2.6 → 0.2.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/intelli_agent/openai.rb +10 -10
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae2989e4aa78c7e8021870de24d9455c43921003de84e988f315ca9227fa5994
4
- data.tar.gz: 76aa773505ac530d040f8f3a5f36014e1bfa63ff33849aefd1372cbda28accd0
3
+ metadata.gz: 8f4f0af0654ac3e8e2e468dd804d3f18b254ebadf5649f6786ef05958279b59d
4
+ data.tar.gz: 5cd51d0ac3f2b083cea25cc499b87bcdfc46212e9af3934a4bc3f5fed25f1fa5
5
5
  SHA512:
6
- metadata.gz: eb30c67aef8853173dac4552c5c78563498daf495491d8c68b7e9737911d50ea962ead0fd286a474ff6c3cd16558420f46c0a6c2dc8322a0aaf89565bf6d18d3
7
- data.tar.gz: 2c5d843ae8b8ef3cb047f49b48f6dd9af950ee43416d7e832cdd173fd9233bbb559687a3770d3cf48aab442188f1826edc9e5e4e54995b2791a02ce9f13d6a9b
6
+ metadata.gz: 3508e10d08f4ffbaa16f096e765168953a65b0831bcfe637932b2a808b8b5d0a62a6f049fddfdfbfad75f30ef02c6753980bf4ef216984c8aa5211555a949005
7
+ data.tar.gz: 3d0e9ed70b2acdd03e3cd9a1aedd9de0478ff4cd9187efaf3eda5dbba01d03c2744736e55a161a498af7c58b0a5dabd0a8c6b13c70bd3f5ed3b268fc28fe5482
@@ -36,7 +36,7 @@ module IntelliAgent::OpenAI
36
36
 
37
37
  def self.embeddings(input, model: 'text-embedding-3-large')
38
38
  response = OpenAI::Client.new.embeddings(parameters: { input:, model: })
39
- def response.embedding = dig('data', 0, 'embedding')
39
+ def response.embeddings = dig('data', 0, 'embedding')
40
40
  response
41
41
  end
42
42
 
@@ -55,15 +55,15 @@ module IntelliAgent::OpenAI
55
55
  response
56
56
  end
57
57
 
58
- def self.single_prompt(prompt:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, tools: nil, function_run_context: self)
59
- chat(messages: [{ user: prompt }], model:, response_format:, max_tokens:, tools:, function_run_context:)
58
+ def self.single_prompt(prompt:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, tools: nil, auto_run_functions: false, function_context: nil)
59
+ chat(messages: [{ user: prompt }], model:, response_format:, max_tokens:, tools:, auto_run_functions:, function_context:)
60
60
  end
61
61
 
62
- def self.single_chat(system:, user:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, tools: nil, function_run_context: nil)
63
- chat(messages: [{ system: }, { user: }], model:, response_format:, max_tokens:, tools:, function_run_context:)
62
+ def self.single_chat(system:, user:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, tools: nil, auto_run_functions: false, function_context: nil)
63
+ chat(messages: [{ system: }, { user: }], model:, response_format:, max_tokens:, tools:, auto_run_functions:, function_context:)
64
64
  end
65
65
 
66
- def self.chat(messages:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, tools: nil, function_run_context: self)
66
+ def self.chat(messages:, model: :gpt_basic, response_format: nil, max_tokens: MAX_TOKENS, tools: nil, auto_run_functions: false, function_context: nil)
67
67
  model = select_model(model)
68
68
 
69
69
  # o1 models doesn't support max_tokens, instead max_completion_tokens
@@ -72,7 +72,7 @@ module IntelliAgent::OpenAI
72
72
 
73
73
  messages = parse_messages(messages)
74
74
 
75
- parameters = { model:, messages: }
75
+ parameters = { model:, messages:, store: true }
76
76
 
77
77
  parameters[:max_completion_tokens] = max_completion_tokens if is_o1_model
78
78
  parameters[:max_tokens] = max_completion_tokens unless is_o1_model
@@ -83,8 +83,8 @@ module IntelliAgent::OpenAI
83
83
  response = OpenAI::Client.new.chat(parameters:)
84
84
  response.extend(ResponseExtender)
85
85
 
86
- if response.functions?
87
- raise 'Function run context not provided' if function_run_context.nil?
86
+ if response.functions? && auto_run_functions
87
+ raise 'Function context not provided for auto-running functions' if function_context.nil?
88
88
 
89
89
  parameters[:messages] << response.message
90
90
 
@@ -93,7 +93,7 @@ module IntelliAgent::OpenAI
93
93
  tool_call_id: function[:id],
94
94
  role: :tool,
95
95
  name: function[:name],
96
- content: function_run_context.send(function[:name], **function[:arguments])
96
+ content: function_context.send(function[:name], **function[:arguments])
97
97
  }
98
98
  end
99
99
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intelli_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.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: 2027-09-26 00:00:00.000000000 Z
11
+ date: 2027-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-openai
@@ -52,7 +52,8 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3'
55
- description: A helper layer over Anthropic and OpenAI API
55
+ description: Adds helpers modules, classes and methods to make it easier to use Anthropic
56
+ and OpenAI API
56
57
  email: gedean.dias@gmail.com
57
58
  executables: []
58
59
  extensions: []