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.
- checksums.yaml +4 -4
- data/lib/intelli_agent/openai.rb +9 -9
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f4f0af0654ac3e8e2e468dd804d3f18b254ebadf5649f6786ef05958279b59d
|
4
|
+
data.tar.gz: 5cd51d0ac3f2b083cea25cc499b87bcdfc46212e9af3934a4bc3f5fed25f1fa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3508e10d08f4ffbaa16f096e765168953a65b0831bcfe637932b2a808b8b5d0a62a6f049fddfdfbfad75f30ef02c6753980bf4ef216984c8aa5211555a949005
|
7
|
+
data.tar.gz: 3d0e9ed70b2acdd03e3cd9a1aedd9de0478ff4cd9187efaf3eda5dbba01d03c2744736e55a161a498af7c58b0a5dabd0a8c6b13c70bd3f5ed3b268fc28fe5482
|
data/lib/intelli_agent/openai.rb
CHANGED
@@ -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,
|
59
|
-
chat(messages: [{ user: prompt }], model:, response_format:, max_tokens:, tools:,
|
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,
|
63
|
-
chat(messages: [{ system: }, { user: }], model:, response_format:, max_tokens:, tools:,
|
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,
|
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
|
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:
|
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.
|
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-
|
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:
|
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: []
|