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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/promptspec.rb +13 -11
  3. data/promptspec.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff9862c476f10363aff3327d9f365b0dce6a3d09967569d6336bdd78b7897571
4
- data.tar.gz: 33b50174079b344a29d8d230ba844bc363fd43cb8fb2d63f9fdf70c11ad48821
3
+ metadata.gz: 02cda944eeaf09e58bd5ce6735e6c3f04346624d40be692d6de61b584717846c
4
+ data.tar.gz: acac7f476102409d6b1b0f9f277a8ccd00de474ffdd2044f4469960fb221f0f8
5
5
  SHA512:
6
- metadata.gz: cebe769d93847ca3e7383283a6cddd37d0235f53de7d6595b4c9ce642f4626b92d5e46dd25dd200d9a75ee6025e9e4172c8b932f3e47cdd38af75457eaee4c7a
7
- data.tar.gz: ca1d578071ceeefcaffe5af466d974327fe99faa75289aa3590df3f6065aec45c1b60734ca7ada1db979ab2c18e0c49db15a5c8e96dedb8d4f9c8e42b274dedd
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['endpoint'] || construct_default_endpoint
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
- headers = @yaml_content.fetch('headers', {})
82
-
83
- if headers.empty?
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
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
@@ -1,7 +1,7 @@
1
1
  # promptspec.gemspec
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "promptspec"
4
- spec.version = "0.0.6"
4
+ spec.version = "0.0.7"
5
5
  spec.authors = ["Hyperaide, John Paul, Daniel Paul"]
6
6
  spec.email = ["jp@hyperaide.com"]
7
7
 
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.6
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-04 00:00:00.000000000 Z
11
+ date: 2023-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaml