intelli_agent 0.2.7 → 0.2.8

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/intelli_agent/openai.rb +9 -9
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56264e1d88fa6a52d6d65f14264646854cc29b6666f513735bf79128f215f2f7
4
- data.tar.gz: 598ebf37db6bcf4c5812295d5a256c2b798bccf4a438e106523faa784e56953f
3
+ metadata.gz: 8f4f0af0654ac3e8e2e468dd804d3f18b254ebadf5649f6786ef05958279b59d
4
+ data.tar.gz: 5cd51d0ac3f2b083cea25cc499b87bcdfc46212e9af3934a4bc3f5fed25f1fa5
5
5
  SHA512:
6
- metadata.gz: d3fe6cf52e0bd87ef18c2eb6a0a8303011f3f1c452725b89e6777893a1d0f9d74a1e70e83e4163debecc9b61da7d89abc3170cdbb0d914792504c63b44e1e41c
7
- data.tar.gz: ab6c01af01c1ba607ed8524ec09e401f841ac6c6c0a5d8842f1f7d110710f7eaca29c9a0d784e94ae4927a2495c1e8006a5c3e13d40d7c9cd26da743ba3dc58d
6
+ metadata.gz: 3508e10d08f4ffbaa16f096e765168953a65b0831bcfe637932b2a808b8b5d0a62a6f049fddfdfbfad75f30ef02c6753980bf4ef216984c8aa5211555a949005
7
+ data.tar.gz: 3d0e9ed70b2acdd03e3cd9a1aedd9de0478ff4cd9187efaf3eda5dbba01d03c2744736e55a161a498af7c58b0a5dabd0a8c6b13c70bd3f5ed3b268fc28fe5482
@@ -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.7
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-30 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: []