foobara-open-ai-api 0.0.5 → 0.0.6
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/CHANGELOG.md +4 -0
- data/src/foobara/ai/open_ai_api/create_chat_completion.rb +2 -2
- data/src/foobara/ai/open_ai_api/types/chat_completion/choice.rb +18 -0
- data/src/foobara/ai/open_ai_api/types/chat_completion/message.rb +16 -0
- data/src/foobara/ai/open_ai_api/types/chat_completion/usage.rb +17 -0
- data/src/foobara/ai/open_ai_api/types/chat_completion.rb +20 -0
- metadata +5 -2
- data/src/foobara/ai/open_ai_api/types/completion.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76be1cb3c24b8c905e2cc04313eef59367c09851ad6607fdff0005236ca4e285
|
4
|
+
data.tar.gz: ec7b733d9046a178066070d8ad1095211184c511ec0e05a614f699082ad2396f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15b45c0ae249d87eeda1563f7ff525f366a266d55a6e5a4ae96e9e3ed3ab6d6974244880c90106842b7985eea1f79417c65513cd32f0cad27c564f990d1e3ae1
|
7
|
+
data.tar.gz: 26734ceffbd9b5f6923e7339754461ce4cd679a9756d9f5fa331aa12cffb2f297f4b50b2987fb9b7e9bc96ad15461de8b9cfd181b36f2f6843dec896d2dee93f
|
data/CHANGELOG.md
CHANGED
@@ -15,7 +15,7 @@ module Foobara
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
result Types::
|
18
|
+
result Types::ChatCompletion
|
19
19
|
|
20
20
|
def execute
|
21
21
|
build_request_body
|
@@ -60,7 +60,7 @@ module Foobara
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def build_completion
|
63
|
-
self.completion = Types::
|
63
|
+
self.completion = Types::ChatCompletion.new(response_body)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Foobara
|
2
|
+
module Ai
|
3
|
+
module OpenAiApi
|
4
|
+
module Types
|
5
|
+
class ChatCompletion < Foobara::Model
|
6
|
+
class Choice < Foobara::Model
|
7
|
+
attributes do
|
8
|
+
index :integer
|
9
|
+
message Message
|
10
|
+
logprobs :duck # what is this? null in documentation
|
11
|
+
finish_reason :string, one_of: %w[stop] # what are the real values here?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Foobara
|
2
|
+
module Ai
|
3
|
+
module OpenAiApi
|
4
|
+
module Types
|
5
|
+
class ChatCompletion < Foobara::Model
|
6
|
+
class Message < Foobara::Model
|
7
|
+
attributes do
|
8
|
+
role :string, one_of: %w[assistant user system]
|
9
|
+
content :string
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Foobara
|
2
|
+
module Ai
|
3
|
+
module OpenAiApi
|
4
|
+
module Types
|
5
|
+
class ChatCompletion < Foobara::Model
|
6
|
+
class Usage < Foobara::Model
|
7
|
+
attributes do
|
8
|
+
prompt_tokens :integer
|
9
|
+
completion_tokens :integer
|
10
|
+
total_tokens :integer
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Foobara
|
2
|
+
module Ai
|
3
|
+
module OpenAiApi
|
4
|
+
module Types
|
5
|
+
class ChatCompletion < Foobara::Model
|
6
|
+
attributes do
|
7
|
+
id :string
|
8
|
+
# TODO: create sugar of equals for specifying an exact value
|
9
|
+
object :string, one_of: ["chat.completion"]
|
10
|
+
created :datetime
|
11
|
+
model :string
|
12
|
+
system_fingerprint :string, :allow_nil
|
13
|
+
choices [Choice]
|
14
|
+
usage Usage
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara-open-ai-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
@@ -37,7 +37,10 @@ files:
|
|
37
37
|
- lib/foobara/open_ai_api.rb
|
38
38
|
- src/foobara/ai/open_ai_api.rb
|
39
39
|
- src/foobara/ai/open_ai_api/create_chat_completion.rb
|
40
|
-
- src/foobara/ai/open_ai_api/types/
|
40
|
+
- src/foobara/ai/open_ai_api/types/chat_completion.rb
|
41
|
+
- src/foobara/ai/open_ai_api/types/chat_completion/choice.rb
|
42
|
+
- src/foobara/ai/open_ai_api/types/chat_completion/message.rb
|
43
|
+
- src/foobara/ai/open_ai_api/types/chat_completion/usage.rb
|
41
44
|
homepage: https://github.com/foobara/open-ai-api
|
42
45
|
licenses:
|
43
46
|
- Apache-2.0
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Foobara
|
2
|
-
module Ai
|
3
|
-
module OpenAiApi
|
4
|
-
module Types
|
5
|
-
class Completion < Foobara::Model
|
6
|
-
class Message < Foobara::Model
|
7
|
-
attributes do
|
8
|
-
role :string, one_of: %w[assistant user system]
|
9
|
-
content :string
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Choice < Foobara::Model
|
14
|
-
attributes do
|
15
|
-
index :integer
|
16
|
-
message Message
|
17
|
-
logprobs :duck # what is this? null in documentation
|
18
|
-
finish_reason :string, one_of: %w[stop] # what are the real values here?
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class Usage < Foobara::Model
|
23
|
-
attributes do
|
24
|
-
prompt_tokens :integer
|
25
|
-
completion_tokens :integer
|
26
|
-
total_tokens :integer
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
attributes do
|
31
|
-
id :string
|
32
|
-
# TODO: create sugar of equals for specifying an exact value
|
33
|
-
object :string, one_of: ["chat.completion"]
|
34
|
-
created :datetime
|
35
|
-
model :string
|
36
|
-
system_fingerprint :string, :allow_nil
|
37
|
-
choices [Choice]
|
38
|
-
usage Usage
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|