foobara-open-ai-api 0.0.5 → 0.0.7
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 +10 -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 +17 -0
- data/src/foobara/ai/open_ai_api/types/chat_completion/usage.rb +27 -0
- data/src/foobara/ai/open_ai_api/types/chat_completion.rb +21 -0
- metadata +6 -3
- 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: ef8553ce176e7f0b8d4059b06c7606ff4670381d404f51db536812dec5eb6469
|
4
|
+
data.tar.gz: 6736eb9ce73a9b6f1f6b7e56a09e347d80cec7c3dfe81f69f757c21415837657
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c73216f70e9cbf0ef4ef224c2c8db9be55a39102f19bd799edbd86d5a583d43dd450a5d36b6fd761eaaa4267a22144094ecbcda564feea1c82390f90e587a44
|
7
|
+
data.tar.gz: b80ee1a7820d1ced6bf690d1b6b5bb517a14c789f76aaab0cf75573913ca12003a3c5395c893f28af620580130acc77fe3e9e280248ce9743246c3203bea54eb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## [0.0.7] - 2025-02-17
|
2
|
+
|
3
|
+
- Add support for some newly added fields
|
4
|
+
- Make sure our models don't break when OpenAI adds new attributes to their responses
|
5
|
+
before we have a chance to update them
|
6
|
+
|
7
|
+
## [0.0.6] - 2025-02-16
|
8
|
+
|
9
|
+
- Rename Completion to ChatCompletion
|
10
|
+
|
1
11
|
## [0.0.5] - 2025-02-16
|
2
12
|
|
3
13
|
- Rename GenerateChatCompletion to CreateChatCompletion
|
@@ -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,17 @@
|
|
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
|
+
refusal :string, :allow_nil
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
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
|
+
prompt_tokens_details do
|
12
|
+
audio_tokens :integer
|
13
|
+
cached_tokens :integer
|
14
|
+
end
|
15
|
+
completion_tokens_details do
|
16
|
+
accepted_prediction_tokens :integer
|
17
|
+
audio_tokens :integer
|
18
|
+
reasoning_tokens :integer
|
19
|
+
rejected_prediction_tokens :integer
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
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
|
+
service_tier :string, :allow_nil, one_of: %w[auto default]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-17 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: foobara
|
@@ -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
|