foobara-open-ai-api 0.0.8 → 0.0.9
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 +2 -1
- data/src/foobara/ai/open_ai_api/base_command.rb +9 -3
- data/src/foobara/ai/open_ai_api.rb +10 -0
- 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: 5e6cb9bdbfee03bc629c3c4b2641363f846dec53e14317860cda02c7be0faa22
|
4
|
+
data.tar.gz: 60f99581e848a20defcbfbc5f9ba5b01fa4b30a61a49bb8399c557eb8cfd2921
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f79050ea578166386b43af65ed4efe7249e92aba4d3c87eced62d5e8859a65634c2e852fd18a304fccfd8d904a4a7a40d7c4a092ab030b89fe9c7cd0c684cb2f
|
7
|
+
data.tar.gz: 3ae087e54109610caa2ce6d065d8658587b751612bf7ddc26e0a7b00b4f69a4ce5db72b1a85073979ca2f47d9ae951d6ce57e4e4c4a453e5eccb207961fb8d91
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
## [0.0.
|
1
|
+
## [0.0.8] - 2025-02-17
|
2
2
|
|
3
3
|
- Add support for some newly added fields
|
4
4
|
- Make sure our models don't break when OpenAI adds new attributes to their responses
|
5
5
|
before we have a chance to update them
|
6
6
|
- Implement ListModels
|
7
|
+
- Provide a way to set api token on project module
|
7
8
|
|
8
9
|
## [0.0.6] - 2025-02-16
|
9
10
|
|
@@ -4,18 +4,24 @@ module Foobara
|
|
4
4
|
module Ai
|
5
5
|
module OpenAiApi
|
6
6
|
class BaseCommand < Foobara::Command
|
7
|
+
class << self
|
8
|
+
attr_accessor :api_token
|
9
|
+
end
|
10
|
+
|
7
11
|
include HttpApiCommand
|
8
12
|
|
9
13
|
base_url "https://api.openai.com/v1"
|
10
14
|
|
11
15
|
inputs do
|
12
|
-
# TODO: come up with some kind of execution context object to wrap all of these calls upon which
|
13
|
-
# data wrapping a "request" can live instead of being passed around?
|
14
16
|
api_token :string
|
15
17
|
end
|
16
18
|
|
17
19
|
def api_token
|
18
|
-
inputs[:api_token] ||
|
20
|
+
inputs[:api_token] || BaseCommand.api_token || api_token_from_env
|
21
|
+
end
|
22
|
+
|
23
|
+
def api_token_from_env
|
24
|
+
ENV.fetch("OPENAI_API_KEY", nil)
|
19
25
|
end
|
20
26
|
|
21
27
|
def build_request_headers
|