autoflux-openai 0.1.0

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.
data/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "type": "module",
3
+ "devDependencies": {
4
+ "@commitlint/cli": "^19.6.1",
5
+ "@commitlint/config-conventional": "^19.6.0",
6
+ "husky": "^9.1.7"
7
+ },
8
+ "scripts": {
9
+ "prepare": "husky"
10
+ }
11
+ }
@@ -0,0 +1,21 @@
1
+ module Autoflux
2
+ module OpenAI
3
+ type agentResponse = Hash[Symbol, untyped] & _ToJson
4
+ type toolCall = Hash[Symbol, untyped]
5
+
6
+ # The agent is design to use OpenAI as an agent
7
+ class Agent
8
+ @client: Client
9
+ @model: String
10
+ @memory: _Memory
11
+ @_tools: Array[_Tool]
12
+
13
+ def initialize: (model: String, ?client: Client, ?memory: _Memory) -> void
14
+ def call: (String prompt, **untyped context) -> _ToS
15
+ def use: (toolCall call, **untyped context) -> _ToJson
16
+ def complete: () -> agentResponse
17
+ def tools: () -> Array[_ToJson]?
18
+ def tool: (String name) -> _Tool?
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ module Autoflux
2
+ module OpenAI
3
+ # The minimal completion api client to interact with OpenAI
4
+ class Client
5
+ @api_key: String
6
+ @endpoint: URI::Generic
7
+ @headers: Hash[String, String]
8
+ @http: Net::HTTP
9
+
10
+ DEFAULT_ENDPOINT: URI::Generic
11
+
12
+ def initialize: (?api_key: String, ?endpoint: URI::Generic) -> void
13
+ def call: (::_ToJson payload) -> Hash[Symbol, untyped]
14
+ def headers: () -> Hash[String, String]
15
+ def http: () -> Net::HTTP
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ module Autoflux
2
+ module OpenAI
3
+ interface _Memory
4
+ include _ToA[_ToJson]
5
+
6
+ def push: (*_ToJson) -> self
7
+ def <<: (_ToJson) -> self
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,22 @@
1
+ module Autoflux
2
+ module OpenAI
3
+ type toolParam = Hash[Symbol, untyped]
4
+
5
+ interface _Tool
6
+ def name: () -> String
7
+ def description: () -> String
8
+ def parameters: () -> _ToJson
9
+ def call: (toolParam params, **untyped context) -> _ToJson
10
+ end
11
+
12
+ class Tool
13
+ include _Tool
14
+
15
+ @name: String
16
+ @description: String
17
+ @parameters: _ToJson
18
+
19
+ def initialize: (name: String, description: String, parameters: _ToJson) ?{ (toolParam params, **untyped context) -> _ToJson } -> void
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,8 @@
1
+ module Autoflux
2
+ module OpenAI
3
+ VERSION: String
4
+
5
+ class Error < StandardError
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: autoflux-openai
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aotokitsuruya
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-01-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: The OpenAI agent for Autoflux
14
+ email:
15
+ - contact@aotoki.me
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".husky/commit-msg"
21
+ - ".husky/pre-commit"
22
+ - ".rspec"
23
+ - ".rubocop.yml"
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - Steepfile
28
+ - commitlint.config.js
29
+ - lib/autoflux/openai.rb
30
+ - lib/autoflux/openai/agent.rb
31
+ - lib/autoflux/openai/client.rb
32
+ - lib/autoflux/openai/tool.rb
33
+ - lib/autoflux/openai/version.rb
34
+ - package-lock.json
35
+ - package.json
36
+ - sig/autoflux/openai.rbs
37
+ - sig/autoflux/openai/agent.rbs
38
+ - sig/autoflux/openai/client.rbs
39
+ - sig/autoflux/openai/memory.rbs
40
+ - sig/autoflux/openai/tool.rbs
41
+ homepage: https://github.com/elct9620/autoflux-openai
42
+ licenses:
43
+ - Apache-2.0
44
+ metadata:
45
+ homepage_uri: https://github.com/elct9620/autoflux-openai
46
+ source_code_uri: https://github.com/elct9620/autoflux-openai
47
+ rubygems_mfa_required: 'true'
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 3.2.0
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubygems_version: 3.5.22
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: The OpenAI agent for Autoflux
67
+ test_files: []