promptspec 0.0.6 → 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/lib/promptspec.rb +13 -11
- data/promptspec.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02cda944eeaf09e58bd5ce6735e6c3f04346624d40be692d6de61b584717846c
|
4
|
+
data.tar.gz: acac7f476102409d6b1b0f9f277a8ccd00de474ffdd2044f4469960fb221f0f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a665777ac2a33223b7104dce51e23dd0420c37d72973bbd4fe3b32126cecba11c4e614ce3981a0b107ceb3df6a79ff3825f1bf6fea9a2ee50921d906555be2c
|
7
|
+
data.tar.gz: f8573b02222b519c0b79ee3c62385f4fcd49a1ef90d034e3c3ad32edf345a1dabb4efb1af1c24987ad978196c774427114d656f65fd82bf20b7e9a3e84d88b62
|
data/lib/promptspec.rb
CHANGED
@@ -48,7 +48,7 @@ class PromptSpec
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def construct_endpoint_request
|
51
|
-
endpoint = @yaml_content['
|
51
|
+
endpoint = @yaml_content['url'] || construct_default_endpoint
|
52
52
|
headers = construct_headers
|
53
53
|
payload = @yaml_content['prompt']
|
54
54
|
|
@@ -78,17 +78,19 @@ class PromptSpec
|
|
78
78
|
|
79
79
|
def construct_headers
|
80
80
|
@headers ||= begin
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
81
|
+
yaml_headers = @yaml_content.fetch('headers', {})
|
82
|
+
headers = {}
|
83
|
+
|
84
|
+
case @model
|
85
|
+
when 'gpt-4', 'gpt-4-0613', 'gpt-4-32k', 'gpt-4-32k-0613', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-3.5-turbo-0613', 'gpt-3.5-turbo-16k-0613'
|
86
|
+
api_key = ENV['OPENAI_API_KEY']
|
87
|
+
headers['Authorization'] = "Bearer #{api_key}" if api_key
|
88
|
+
# Add more cases here for other providers
|
90
89
|
end
|
91
|
-
|
90
|
+
else
|
91
|
+
headers.merge!(yaml_headers)
|
92
|
+
end
|
93
|
+
|
92
94
|
headers['Content-Type'] = 'application/json' unless headers.key?('Content-Type')
|
93
95
|
headers
|
94
96
|
end
|
data/promptspec.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promptspec
|
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
|
- Hyperaide, John Paul, Daniel Paul
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yaml
|