multiwoven-integrations 0.43.3 → 0.43.5
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/multiwoven/integrations/core/constants.rb +2 -1
- data/lib/multiwoven/integrations/core/source_connector.rb +9 -0
- data/lib/multiwoven/integrations/rollout.rb +1 -1
- data/lib/multiwoven/integrations/source/aisquared/client.rb +14 -7
- data/lib/multiwoven/integrations/source/aisquared/config/models.json +2 -2
- data/lib/multiwoven/integrations/source/generic_open_ai/client.rb +4 -1
- data/lib/multiwoven/integrations/source/http_model/client.rb +4 -1
- 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: 4bd88d781a843b2eba495c4bfbdc2b500959e500e2353e573aa7683d61e455eb
|
|
4
|
+
data.tar.gz: 927a30002241a9f3968060e9c7bf47470d16a7f5c5d1f56cdff26af8eab526a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1dc54cd478b970024017d1f37fd20953b9d422f1d81f75fb1a29a3b12dd23282b66366fcae454ed834bb58d61b76610ee3ddc83bf130988942a3151e01d950e
|
|
7
|
+
data.tar.gz: e1dce10a478a5faef77ac88c84bef309e451b23e1539e4afe0de199d3f3fe1aa2e00db35011abef21c4cb0a99d3c6b5e6e8a01826b1b66932f87398bfa12d39c
|
|
@@ -124,7 +124,8 @@ module Multiwoven
|
|
|
124
124
|
}.freeze
|
|
125
125
|
|
|
126
126
|
# Aisquared Bolt
|
|
127
|
-
|
|
127
|
+
AISQUARED_CHAT_ENDPOINT_URL = ENV["AISQUARED_CHAT_ENDPOINT_URL"]
|
|
128
|
+
AISQUARED_BOLT_API_KEY = ENV["AISQUARED_BOLT_API_KEY"]
|
|
128
129
|
|
|
129
130
|
# Microsoft Graph
|
|
130
131
|
MICROSOFT_GRAPH_BASE = "https://graph.microsoft.com/v1.0"
|
|
@@ -54,6 +54,15 @@ module Multiwoven
|
|
|
54
54
|
)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
def parse_request_format(request_format, required:)
|
|
58
|
+
return [request_format, nil] if request_format.is_a?(Hash)
|
|
59
|
+
return [nil, required ? "Request Format is required to test the connection" : nil] if request_format.blank?
|
|
60
|
+
|
|
61
|
+
[JSON.parse(request_format), nil]
|
|
62
|
+
rescue JSON::ParserError
|
|
63
|
+
[nil, "Request Format must be valid JSON"]
|
|
64
|
+
end
|
|
65
|
+
|
|
57
66
|
def send_streaming_request(options = {})
|
|
58
67
|
Multiwoven::Integrations::Core::StreamingHttpClient.request(
|
|
59
68
|
options[:url],
|
|
@@ -7,7 +7,7 @@ module Multiwoven::Integrations::Source
|
|
|
7
7
|
class AisquaredError < StandardError; end
|
|
8
8
|
|
|
9
9
|
def check_connection(connection_config)
|
|
10
|
-
response = make_request(
|
|
10
|
+
response = make_request(chat_endpoint_url, HTTP_POST, connection_config[:request_format], connection_config)
|
|
11
11
|
success?(response) ? success_status : failure_status_from_response(response)
|
|
12
12
|
rescue StandardError => e
|
|
13
13
|
handle_exception(e, { context: "AISQUARED_BOLT:CHECK_CONNECTION:EXCEPTION", type: "error" })
|
|
@@ -40,11 +40,18 @@ module Multiwoven::Integrations::Source
|
|
|
40
40
|
super && !embedding_model?(model)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
def
|
|
44
|
-
host =
|
|
45
|
-
raise AisquaredError, "
|
|
43
|
+
def chat_endpoint_url
|
|
44
|
+
host = AISQUARED_CHAT_ENDPOINT_URL.to_s.strip
|
|
45
|
+
raise AisquaredError, "AISQUARED_CHAT_ENDPOINT_URL is not configured" if host.empty?
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
host
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def api_key
|
|
51
|
+
key = AISQUARED_BOLT_API_KEY.to_s.strip
|
|
52
|
+
raise AisquaredError, "AISQUARED_BOLT_API_KEY is not configured" if key.empty?
|
|
53
|
+
|
|
54
|
+
key
|
|
48
55
|
end
|
|
49
56
|
|
|
50
57
|
def parse_json(json_string)
|
|
@@ -60,13 +67,13 @@ module Multiwoven::Integrations::Source
|
|
|
60
67
|
url: url,
|
|
61
68
|
http_method: http_method,
|
|
62
69
|
payload: JSON.parse(payload),
|
|
63
|
-
headers: { "Content-Type" => "application/json" }
|
|
70
|
+
headers: { "Content-Type" => "application/json", "Authorization" => "Bearer #{api_key}" }
|
|
64
71
|
)
|
|
65
72
|
end
|
|
66
73
|
|
|
67
74
|
# TODO: Add support for streaming when Lightning Endpoint supports it.
|
|
68
75
|
def run_model(connection_config, payload)
|
|
69
|
-
response = make_request(
|
|
76
|
+
response = make_request(chat_endpoint_url, HTTP_POST, payload, connection_config)
|
|
70
77
|
process_response(response)
|
|
71
78
|
rescue StandardError => e
|
|
72
79
|
handle_exception(e, { context: "AISQUARED_BOLT:RUN_MODEL:EXCEPTION", type: "error" })
|
|
@@ -6,10 +6,13 @@ module Multiwoven::Integrations::Source
|
|
|
6
6
|
class Client < SourceConnector
|
|
7
7
|
def check_connection(connection_config)
|
|
8
8
|
connection_config = prepare_config(connection_config)
|
|
9
|
+
payload, error = parse_request_format(connection_config[:request_format], required: true)
|
|
10
|
+
return failure_status(error) if error
|
|
11
|
+
|
|
9
12
|
response = send_request(
|
|
10
13
|
url: connection_config[:url],
|
|
11
14
|
http_method: HTTP_POST,
|
|
12
|
-
payload:
|
|
15
|
+
payload: payload,
|
|
13
16
|
headers: auth_headers(connection_config[:api_key]),
|
|
14
17
|
config: connection_config[:config]
|
|
15
18
|
)
|
|
@@ -6,10 +6,13 @@ module Multiwoven::Integrations::Source
|
|
|
6
6
|
class Client < SourceConnector
|
|
7
7
|
def check_connection(connection_config)
|
|
8
8
|
connection_config = prepare_config(connection_config)
|
|
9
|
+
payload, error = parse_request_format(connection_config[:request_format], required: false)
|
|
10
|
+
return failure_status(error) if error
|
|
11
|
+
|
|
9
12
|
response = send_request(
|
|
10
13
|
url: connection_config[:url_host],
|
|
11
14
|
http_method: connection_config[:http_method],
|
|
12
|
-
payload:
|
|
15
|
+
payload: payload,
|
|
13
16
|
headers: connection_config[:headers],
|
|
14
17
|
config: connection_config[:config]
|
|
15
18
|
)
|