intelli_agent 0.0.1 → 0.0.2
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/{ai/agent.rb → intelli_agent.rb} +10 -17
- metadata +4 -7
- data/lib/ai/agent.rb:Zone.Identifier +0 -0
- data/lib/ai/agent_test.rb_:Zone.Identifier +0 -0
- data/lib/ai.rb:Zone.Identifier +0 -0
- /data/lib/{ai → intelli_agent}/agent_test.rb_ +0 -0
- /data/lib/{ai.rb → intelli_agent/ai.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1af98056d1cfee93c37a849051ec08bbd94ff1b08e06c51df43459d0da2b39f
|
4
|
+
data.tar.gz: 558d8b96efc731bb945d73a3d107a017147be910d57fcde9b9e84e0e20fcd42b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a59b52b56baea277a307efc5d9fa6b6f209292fec80842378001f2394084e1db3b2ee4e47d197aa75366e7da85b9941885566e67ccd26de03069f0a64582427
|
7
|
+
data.tar.gz: a0779b693af7c7ac8856f1fae3dbdb91bb0ceceef1cb3e70c97b675dc47f1d60f22ece30e6447ff7a7a3ff9ed40abc99a96ce6768c169a2f3dbe6d81f3998e5e
|
@@ -1,10 +1,14 @@
|
|
1
|
-
|
1
|
+
#require_relative './intelli_agent/ai'
|
2
|
+
require 'intelli_agent/ai'
|
3
|
+
|
4
|
+
class IntelliAgent
|
5
|
+
extend AI
|
2
6
|
attr_reader :assistant, :thread, :instructions, :vector_store_id
|
3
7
|
|
4
8
|
def initialize(assistant_id: nil, thread_id: nil, thread_instructions: nil, vector_store_id: nil)
|
5
9
|
@openai_client = OpenAI::Client.new
|
6
10
|
|
7
|
-
assistant_id ||= ENV.fetch('
|
11
|
+
assistant_id ||= ENV.fetch('OPENAI_ASSISTANT_ID')
|
8
12
|
@assistant = @openai_client.assistants.retrieve(id: assistant_id)
|
9
13
|
|
10
14
|
thread_params = {}
|
@@ -19,17 +23,10 @@ class AI::Agent
|
|
19
23
|
@instructions = thread_instructions || @assistant['instructions']
|
20
24
|
end
|
21
25
|
|
22
|
-
def add_message(text, role: 'user')
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def messages
|
27
|
-
@openai_client.messages.list(thread_id: @thread['id'])
|
28
|
-
end
|
29
|
-
|
30
|
-
def last_message
|
31
|
-
messages['data'].first['content'].first['text']['value']
|
32
|
-
end
|
26
|
+
def add_message(text, role: 'user') = @openai_client.messages.create(thread_id: @thread['id'], parameters: { role: role, content: text })
|
27
|
+
def messages = @openai_client.messages.list(thread_id: @thread['id'])
|
28
|
+
def last_message = messages['data'].first['content'].first['text']['value']
|
29
|
+
def runs = @openai_client.runs.list(thread_id: @thread['id'])
|
33
30
|
|
34
31
|
def run(instructions: nil, additional_instructions: nil, additional_message: nil, model: nil, tool_choice: nil)
|
35
32
|
params = { assistant_id: @assistant['id'] }
|
@@ -64,8 +61,4 @@ class AI::Agent
|
|
64
61
|
end
|
65
62
|
end
|
66
63
|
end
|
67
|
-
|
68
|
-
def runs
|
69
|
-
@openai_client.runs.list(thread_id: @thread['id'])
|
70
|
-
end
|
71
64
|
end
|
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.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gedean Dias
|
@@ -31,12 +31,9 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- README.md
|
34
|
-
- lib/
|
35
|
-
- lib/
|
36
|
-
- lib/ai
|
37
|
-
- lib/ai/agent.rb:Zone.Identifier
|
38
|
-
- lib/ai/agent_test.rb_
|
39
|
-
- lib/ai/agent_test.rb_:Zone.Identifier
|
34
|
+
- lib/intelli_agent.rb
|
35
|
+
- lib/intelli_agent/agent_test.rb_
|
36
|
+
- lib/intelli_agent/ai.rb
|
40
37
|
homepage: https://github.com/gedean/intelli_agent
|
41
38
|
licenses:
|
42
39
|
- MIT
|
File without changes
|
File without changes
|
data/lib/ai.rb:Zone.Identifier
DELETED
File without changes
|
File without changes
|
File without changes
|