autoflux-openai 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/lib/autoflux/openai/agent.rb +5 -2
- data/lib/autoflux/openai/tool.rb +1 -1
- data/lib/autoflux/openai/version.rb +1 -1
- data/sig/autoflux/openai/agent.rbs +4 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e645074c500ce6b5ad07961575ac7dbbdb7ef71e7aa2ab43cf4e64c2bf7e1803
|
4
|
+
data.tar.gz: 4f490577cce14147d94dc9da67f8daeb21d73331c719495f581a6ce21427f320
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e33369742bb10fc82baa2a0b64cac4a631f231143412ac7f87e55beeab4e6cc8d8b9d4449f756bafaa1f9facec416726d5113d42132b6498cd5eee068a2d3f90
|
7
|
+
data.tar.gz: e837e78f01bbd99dc26ab5c93cd4f269ed0dcf507de5c1062cefc9516b2aacb0362f94d56b44a1a4c510f1cfeee636e6e6272b15ca75fac147605f4ca0c0fb56
|
data/README.md
CHANGED
@@ -27,7 +27,15 @@ res = agent.call("Hello, world!")
|
|
27
27
|
# => "Hello, world!" from OpenAI
|
28
28
|
```
|
29
29
|
|
30
|
-
> The agent will return `content` from the as the interface of the `autoflux` agent.
|
30
|
+
> The agent will return `content` from the response as the interface of the `autoflux` agent.
|
31
|
+
|
32
|
+
If you want to use as multi agents the agent name can be set.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
agent = Autoflux::OpenAI::Agent.new(name: "shopping", model: "gpt-4o-mini")
|
36
|
+
res = agent.call("Hello, world!")
|
37
|
+
# => "Hello, world!" from OpenAI
|
38
|
+
```
|
31
39
|
|
32
40
|
### Tool
|
33
41
|
|
@@ -4,11 +4,14 @@ module Autoflux
|
|
4
4
|
module OpenAI
|
5
5
|
# The agent is design to use OpenAI as an agent
|
6
6
|
class Agent
|
7
|
-
|
7
|
+
DEFAULT_NAME = "openai"
|
8
8
|
|
9
|
-
|
9
|
+
attr_reader :name, :model, :memory
|
10
|
+
|
11
|
+
def initialize(model:, name: DEFAULT_NAME, client: Client.new, tools: [], memory: [])
|
10
12
|
@client = client
|
11
13
|
@model = model
|
14
|
+
@name = name
|
12
15
|
@memory = memory
|
13
16
|
@_tools = tools
|
14
17
|
end
|
data/lib/autoflux/openai/tool.rb
CHANGED
@@ -6,7 +6,7 @@ module Autoflux
|
|
6
6
|
class Tool
|
7
7
|
attr_reader :name, :description, :parameters
|
8
8
|
|
9
|
-
def initialize(name:, description:, parameters:
|
9
|
+
def initialize(name:, description:, parameters: nil, &executor)
|
10
10
|
@name = name
|
11
11
|
@description = description
|
12
12
|
@parameters = parameters
|
@@ -5,12 +5,15 @@ module Autoflux
|
|
5
5
|
|
6
6
|
# The agent is design to use OpenAI as an agent
|
7
7
|
class Agent
|
8
|
+
DEFAULT_NAME: "openai"
|
9
|
+
|
8
10
|
@client: Client
|
9
11
|
@model: String
|
12
|
+
@name: String
|
10
13
|
@memory: _Memory
|
11
14
|
@_tools: Array[_Tool]
|
12
15
|
|
13
|
-
def initialize: (model: String, ?client: Client, ?memory: _Memory) -> void
|
16
|
+
def initialize: (model: String, ?name: String, ?client: Client, ?memory: _Memory) -> void
|
14
17
|
def call: (String prompt, **untyped context) -> _ToS
|
15
18
|
def use: (toolCall call, **untyped context) -> _ToJson
|
16
19
|
def complete: () -> agentResponse
|