foobara-open-ai-api 0.0.9 → 0.0.11
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c61e466a2f1f4ce7908a205c89f8518e0c0bae5f05f507011352b546e796aa5
|
4
|
+
data.tar.gz: 0afacf44c3eaf6ff404bcb4e171fc74ecc833d8b97110fac1967ce650045d949
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dd6e5433e7d018fd9fb30a45f7fe4af6bcaf899ef2323ec1175bbe4d7383361f4abdf8eed6cff746a5964283bc2f269c43d2e3f0dac301b0b467c53a13c8531
|
7
|
+
data.tar.gz: db2e7fe5d1f4f8d013d444f164cd727f6c49d5a95d276899545d5a26f144233a0eae3c708dbebff4da44906dbd6f7a108a9d42f4493b79f32ce03a965fb8ad5c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## [0.0.11] - 2025-02-19
|
2
|
+
|
3
|
+
- Cache the list of models in ListModels
|
4
|
+
- Automatically construct the list of valid model names for model_enum at startup
|
5
|
+
|
6
|
+
## [0.0.10] - 2025-02-18
|
7
|
+
|
8
|
+
- Add a ModelEnum
|
9
|
+
|
1
10
|
## [0.0.8] - 2025-02-17
|
2
11
|
|
3
12
|
- Add support for some newly added fields
|
data/lib/foobara/open_ai_api.rb
CHANGED
@@ -8,7 +8,7 @@ module Foobara
|
|
8
8
|
http_method :post
|
9
9
|
|
10
10
|
add_inputs do
|
11
|
-
model :
|
11
|
+
model :model, default: Types::ModelEnum::GPT_3_5_TURBO
|
12
12
|
messages :array do
|
13
13
|
role :string, one_of: %w[system user assistant]
|
14
14
|
content :string
|
@@ -1,12 +1,16 @@
|
|
1
|
+
require_relative "base_command"
|
2
|
+
require_relative "types/model"
|
3
|
+
require "foobara/cached_command"
|
4
|
+
|
1
5
|
module Foobara
|
2
6
|
module Ai
|
3
7
|
module OpenAiApi
|
4
8
|
class ListModels < BaseCommand
|
5
|
-
|
9
|
+
include CachedCommand
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
|
11
|
+
self.foobara_cache_expiry = 24 * 60 * 60
|
12
|
+
|
13
|
+
path "/models"
|
10
14
|
|
11
15
|
result [Types::Model]
|
12
16
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative "../list_models"
|
2
|
+
|
3
|
+
module Foobara
|
4
|
+
module Ai
|
5
|
+
module OpenAiApi
|
6
|
+
module Types
|
7
|
+
model_list = ListModels.run!.map(&:id).sort
|
8
|
+
|
9
|
+
ModelEnum = Foobara::Enumerated.make_module(model_list)
|
10
|
+
|
11
|
+
OpenAiApi.foobara_register_type(:model, :string, one_of: ModelEnum)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,28 @@
|
|
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.11
|
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-19 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: foobara-cached-command
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '0'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '0'
|
12
26
|
- !ruby/object:Gem::Dependency
|
13
27
|
name: foobara-http-api-command
|
14
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,6 +58,7 @@ files:
|
|
44
58
|
- src/foobara/ai/open_ai_api/types/chat_completion/message.rb
|
45
59
|
- src/foobara/ai/open_ai_api/types/chat_completion/usage.rb
|
46
60
|
- src/foobara/ai/open_ai_api/types/model.rb
|
61
|
+
- src/foobara/ai/open_ai_api/types/model_enum.rb
|
47
62
|
homepage: https://github.com/foobara/open-ai-api
|
48
63
|
licenses:
|
49
64
|
- Apache-2.0
|