venice_client 1.0.15 → 1.0.17
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/Gemfile.lock +1 -1
- data/lib/venice_client/models/assistant_message.rb +7 -7
- data/lib/venice_client/models/create_chat_completion200_response_choices_inner.rb +7 -7
- data/lib/venice_client/models/create_chat_completion200_response_choices_inner_message.rb +1 -1
- data/lib/venice_client/models/system_message.rb +7 -7
- data/lib/venice_client/models/tool_message.rb +7 -7
- data/lib/venice_client/models/user_message.rb +7 -7
- data/lib/venice_client/version.rb +1 -1
- data/spec/api/chat_api_spec.rb +16 -5
- 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: a0cbefd13c67a261525a89ba0a0b50d14734bdbad9c0ad66222cb5bc04d51136
|
|
4
|
+
data.tar.gz: '0397489ebd04affd92c900413805d31bbf8cdc2aafee43e3d2c45cece6b0da93'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aab00140f7893df5ab571e4963d539f4723aa694b675c61f44b3bad9dd35aa0d8398ddb584f780f623d2da0bbcef715aa2e265e8e27c2e3b22df6841260b9c5b
|
|
7
|
+
data.tar.gz: 43857e6dfcbccf63170fdcaa64d156fbfa84853715e615974a2704d9e5c1839492b04507a4787e9f82ff090ec888fba7352cddbe99c690bf8413d93e71902d21
|
data/Gemfile.lock
CHANGED
|
@@ -99,9 +99,9 @@ module VeniceClient
|
|
|
99
99
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
100
100
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
101
101
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
102
|
-
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
103
|
-
|
|
104
|
-
end
|
|
102
|
+
# if (!acceptable_attribute_map.key?(k.to_sym))
|
|
103
|
+
# fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::AssistantMessage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
104
|
+
# end
|
|
105
105
|
h[k.to_sym] = v
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -155,10 +155,10 @@ module VeniceClient
|
|
|
155
155
|
# Custom attribute writer method checking allowed values (enum).
|
|
156
156
|
# @param [Object] role Object to be assigned
|
|
157
157
|
def role=(role)
|
|
158
|
-
validator = EnumAttributeValidator.new('String', ["assistant"])
|
|
159
|
-
unless validator.valid?(role)
|
|
160
|
-
|
|
161
|
-
end
|
|
158
|
+
# validator = EnumAttributeValidator.new('String', ["assistant"])
|
|
159
|
+
# unless validator.valid?(role)
|
|
160
|
+
# fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
|
|
161
|
+
# end
|
|
162
162
|
@role = role
|
|
163
163
|
end
|
|
164
164
|
|
|
@@ -100,9 +100,9 @@ module VeniceClient
|
|
|
100
100
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
101
101
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
102
102
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
103
|
-
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
104
|
-
|
|
105
|
-
end
|
|
103
|
+
# if (!acceptable_attribute_map.key?(k.to_sym))
|
|
104
|
+
# fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::CreateChatCompletion200ResponseChoicesInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
105
|
+
# end
|
|
106
106
|
h[k.to_sym] = v
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -192,9 +192,9 @@ module VeniceClient
|
|
|
192
192
|
# Custom attribute writer method with validation
|
|
193
193
|
# @param [Object] message Value to be assigned
|
|
194
194
|
def message=(message)
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
if message.nil?
|
|
196
|
+
fail ArgumentError, 'message cannot be nil'
|
|
197
|
+
end
|
|
198
198
|
|
|
199
199
|
@message = message
|
|
200
200
|
end
|
|
@@ -202,7 +202,7 @@ module VeniceClient
|
|
|
202
202
|
# Custom attribute writer method checking allowed values (enum).
|
|
203
203
|
# @param [Object] stop_reason Object to be assigned
|
|
204
204
|
def stop_reason=(stop_reason)
|
|
205
|
-
validator = EnumAttributeValidator.new('String', ["stop", "length"])
|
|
205
|
+
validator = EnumAttributeValidator.new('String', ["tool_call", "stop", "length"])
|
|
206
206
|
unless validator.valid?(stop_reason)
|
|
207
207
|
fail ArgumentError, "invalid value for \"stop_reason\", must be one of #{validator.allowable_values}."
|
|
208
208
|
end
|
|
@@ -87,7 +87,7 @@ module VeniceClient
|
|
|
87
87
|
return model if model
|
|
88
88
|
else
|
|
89
89
|
# raise if data contains keys that are not known to the model
|
|
90
|
-
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
90
|
+
# raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
91
91
|
model = const.build_from_hash(data)
|
|
92
92
|
return model if model
|
|
93
93
|
end
|
|
@@ -88,9 +88,9 @@ module VeniceClient
|
|
|
88
88
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
89
89
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
90
90
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
91
|
-
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
92
|
-
|
|
93
|
-
end
|
|
91
|
+
# if (!acceptable_attribute_map.key?(k.to_sym))
|
|
92
|
+
# fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::SystemMessage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
93
|
+
# end
|
|
94
94
|
h[k.to_sym] = v
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -151,10 +151,10 @@ module VeniceClient
|
|
|
151
151
|
# Custom attribute writer method checking allowed values (enum).
|
|
152
152
|
# @param [Object] role Object to be assigned
|
|
153
153
|
def role=(role)
|
|
154
|
-
validator = EnumAttributeValidator.new('String', ["system"])
|
|
155
|
-
unless validator.valid?(role)
|
|
156
|
-
|
|
157
|
-
end
|
|
154
|
+
# validator = EnumAttributeValidator.new('String', ["system"])
|
|
155
|
+
# unless validator.valid?(role)
|
|
156
|
+
# fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
|
|
157
|
+
# end
|
|
158
158
|
@role = role
|
|
159
159
|
end
|
|
160
160
|
|
|
@@ -102,9 +102,9 @@ module VeniceClient
|
|
|
102
102
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
103
103
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
104
104
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
105
|
-
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
106
|
-
|
|
107
|
-
end
|
|
105
|
+
# if (!acceptable_attribute_map.key?(k.to_sym))
|
|
106
|
+
# fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::ToolMessage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
107
|
+
# end
|
|
108
108
|
h[k.to_sym] = v
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -186,10 +186,10 @@ module VeniceClient
|
|
|
186
186
|
# Custom attribute writer method checking allowed values (enum).
|
|
187
187
|
# @param [Object] role Object to be assigned
|
|
188
188
|
def role=(role)
|
|
189
|
-
validator = EnumAttributeValidator.new('String', ["tool"])
|
|
190
|
-
unless validator.valid?(role)
|
|
191
|
-
|
|
192
|
-
end
|
|
189
|
+
# validator = EnumAttributeValidator.new('String', ["tool"])
|
|
190
|
+
# unless validator.valid?(role)
|
|
191
|
+
# fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
|
|
192
|
+
# end
|
|
193
193
|
@role = role
|
|
194
194
|
end
|
|
195
195
|
|
|
@@ -84,9 +84,9 @@ module VeniceClient
|
|
|
84
84
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
85
85
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
86
86
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
87
|
-
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
88
|
-
|
|
89
|
-
end
|
|
87
|
+
# if (!acceptable_attribute_map.key?(k.to_sym))
|
|
88
|
+
# fail ArgumentError, "`#{k}` is not a valid attribute in `VeniceClient::UserMessage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
89
|
+
# end
|
|
90
90
|
h[k.to_sym] = v
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -143,10 +143,10 @@ module VeniceClient
|
|
|
143
143
|
# Custom attribute writer method checking allowed values (enum).
|
|
144
144
|
# @param [Object] role Object to be assigned
|
|
145
145
|
def role=(role)
|
|
146
|
-
validator = EnumAttributeValidator.new('String', ["user"])
|
|
147
|
-
unless validator.valid?(role)
|
|
148
|
-
|
|
149
|
-
end
|
|
146
|
+
# validator = EnumAttributeValidator.new('String', ["user"])
|
|
147
|
+
# unless validator.valid?(role)
|
|
148
|
+
# fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
|
|
149
|
+
# end
|
|
150
150
|
@role = role
|
|
151
151
|
end
|
|
152
152
|
|
data/spec/api/chat_api_spec.rb
CHANGED
|
@@ -19,6 +19,11 @@ require 'json'
|
|
|
19
19
|
describe 'ChatApi' do
|
|
20
20
|
before do
|
|
21
21
|
# run before each test
|
|
22
|
+
VeniceClient.configure do |config|
|
|
23
|
+
# Configure Bearer authorization: BearerAuth
|
|
24
|
+
config.access_token = ENV['VENICE_API_KEY'] || 'YOUR_API_KEY'
|
|
25
|
+
config.debugging = true
|
|
26
|
+
end
|
|
22
27
|
@api_instance = VeniceClient::ChatApi.new
|
|
23
28
|
end
|
|
24
29
|
|
|
@@ -54,12 +59,18 @@ describe 'ChatApi' do
|
|
|
54
59
|
parallel_tool_calls: false
|
|
55
60
|
)
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
begin
|
|
63
|
+
# Make the API call
|
|
64
|
+
result = @api_instance.create_chat_completion(chat_completion_request: chat_completion_request)
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
# Add assertions
|
|
67
|
+
expect(result).to be_instance_of(VeniceClient::CreateChatCompletion200Response)
|
|
68
|
+
expect(result.choices).not_to be_empty
|
|
69
|
+
rescue VeniceClient::ApiError => e
|
|
70
|
+
puts "API Error: #{e.message}"
|
|
71
|
+
puts "Response body: #{e.response_body}"
|
|
72
|
+
fail e
|
|
73
|
+
end
|
|
63
74
|
end
|
|
64
75
|
end
|
|
65
76
|
|