multiwoven-integrations 0.13.2 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f20d31c38b9e0f1311379e2d2b5f6637b2d5241abe6e0504ed0b448eb044909
4
- data.tar.gz: 40f8da2f352ffbbbadee190efd5db47e89008e15d95165f7d7b9cba6d64574ce
3
+ metadata.gz: 214d9d0a9b6aed5037d74615ef55f30994cc6231e5be6b0ee1ffd95cdef4f96b
4
+ data.tar.gz: 84d1a191ec5681d0d1a25a16153614b9b8bdaad426263b6bc416109396545149
5
5
  SHA512:
6
- metadata.gz: cd8d4130999ac7759f1bd8aefa1430ab9d8d2c3bd3a96c392896461ef46e64ac987546d523fd4d4e1851a337ed04e598e0f00ee480c2ce355fa8faaae8855707
7
- data.tar.gz: 064f797d1d1bd3b5290a58325b8c75a8961b4341217a93f6f17ab91403de4f16143f90243f8519abda0b2c04304fe97aee0c89450b853ff1ea956a635e3efc0b
6
+ metadata.gz: 7f19bfda47c77a07744f473c1f1be751c2724453afcf66add6c780aeca06be0a380861afc666690f25eea2f180e4623b995f7ddd60492f9a0e20be940076f08e
7
+ data.tar.gz: 7f837557c947c38ff53c7434c88bd1a996cc7d441024c7e2c3392001abcdb32a6e72ec7515c626bba2a734c016f4e5179bedff3ce3241284bd9a0757d86cef34
@@ -11,7 +11,7 @@ module Multiwoven
11
11
  DestinationSyncMode = Types::String.enum("insert", "upsert")
12
12
  ConnectorType = Types::String.enum("source", "destination")
13
13
  ConnectorQueryType = Types::String.enum("raw_sql", "soql", "ai_ml")
14
- ModelQueryType = Types::String.enum("raw_sql", "dbt", "soql", "table_selector", "ai_ml")
14
+ ModelQueryType = Types::String.enum("raw_sql", "dbt", "soql", "table_selector", "ai_ml", "dynamic_sql")
15
15
  ConnectionStatusType = Types::String.enum("succeeded", "failed")
16
16
  StreamType = Types::String.enum("static", "dynamic", "user_defined")
17
17
  StreamAction = Types::String.enum("fetch", "create", "update", "delete")
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.13.2"
5
+ VERSION = "0.14.1"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
@@ -19,6 +19,7 @@ module Multiwoven
19
19
  DatabricksModel
20
20
  AwsSagemakerModel
21
21
  VertexModel
22
+ HttpModel
22
23
  ].freeze
23
24
 
24
25
  ENABLED_DESTINATIONS = %w[
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven::Integrations::Source
4
+ module HttpModel
5
+ include Multiwoven::Integrations::Core
6
+ class Client < SourceConnector
7
+ def check_connection(connection_config)
8
+ connection_config = connection_config.with_indifferent_access
9
+ url_host = connection_config[:url_host]
10
+ headers = connection_config[:headers]
11
+ response = Multiwoven::Integrations::Core::HttpClient.request(
12
+ url_host,
13
+ HTTP_GET,
14
+ headers: headers
15
+ )
16
+ if success?(response)
17
+ success_status
18
+ else
19
+ failure_status(nil)
20
+ end
21
+ rescue StandardError => e
22
+ handle_exception(e, {
23
+ context: "HTTP MODEL:CHECK_CONNECTION:EXCEPTION",
24
+ type: "error"
25
+ })
26
+ failure_status(e)
27
+ end
28
+
29
+ def discover(_connection_config = nil)
30
+ catalog_json = read_json(CATALOG_SPEC_PATH)
31
+ catalog = build_catalog(catalog_json)
32
+ catalog.to_multiwoven_message
33
+ rescue StandardError => e
34
+ handle_exception(e, {
35
+ context: "HTTP MODEL:DISCOVER:EXCEPTION",
36
+ type: "error"
37
+ })
38
+ end
39
+
40
+ def read(sync_config)
41
+ connection_config = sync_config.source.connection_specification
42
+ connection_config = connection_config.with_indifferent_access
43
+ # The server checks the ConnectorQueryType.
44
+ # If it's "ai_ml," the server calculates the payload and passes it as a query in the sync config model protocol.
45
+ # This query is then sent to the AI/ML model.
46
+ payload = JSON.parse(sync_config.model.query)
47
+ run_model(connection_config, payload)
48
+ rescue StandardError => e
49
+ handle_exception(e, {
50
+ context: "HTTP MODEL:READ:EXCEPTION",
51
+ type: "error"
52
+ })
53
+ end
54
+
55
+ private
56
+
57
+ def run_model(connection_config, payload)
58
+ connection_config = connection_config.with_indifferent_access
59
+ url_host = connection_config[:url_host]
60
+ headers = connection_config[:headers]
61
+ config = connection_config[:config]
62
+ config[:timeout] ||= 30
63
+ response = send_request(url_host, payload, headers, config)
64
+ process_response(response)
65
+ rescue StandardError => e
66
+ handle_exception(e, context: "HTTP MODEL:RUN_MODEL:EXCEPTION", type: "error")
67
+ end
68
+
69
+ def process_response(response)
70
+ if success?(response)
71
+ data = JSON.parse(response.body)
72
+ [RecordMessage.new(data: data, emitted_at: Time.now.to_i).to_multiwoven_message]
73
+ else
74
+ create_log_message("HTTP MODEL:RUN_MODEL", "error", "request failed")
75
+ end
76
+ end
77
+
78
+ def send_request(url, payload, headers, config)
79
+ Multiwoven::Integrations::Core::HttpClient.request(
80
+ url,
81
+ HTTP_POST,
82
+ payload: payload,
83
+ headers: headers,
84
+ config: config
85
+ )
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,6 @@
1
+ {
2
+ "request_rate_limit": 600,
3
+ "request_rate_limit_unit": "minute",
4
+ "request_rate_concurrency": 10,
5
+ "streams": []
6
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "data": {
3
+ "name": "HttpModel",
4
+ "title": "HTTP Model",
5
+ "connector_type": "source",
6
+ "category": "AI Model",
7
+ "documentation_url": "https://docs.mutliwoven.com",
8
+ "github_issue_label": "source-http-model",
9
+ "icon": "icon.svg",
10
+ "license": "MIT",
11
+ "release_stage": "alpha",
12
+ "support_level": "community",
13
+ "tags": ["language:ruby", "multiwoven"]
14
+ }
15
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "documentation_url": "https://docs.multiwoven.com/integrations/source/http-model",
3
+ "stream_type": "user_defined",
4
+ "connector_query_type": "ai_ml",
5
+ "connection_specification": {
6
+ "$schema": "http://json-schema.org/draft-07/schema#",
7
+ "title": "Http Model",
8
+ "type": "object",
9
+ "required": ["url_host"],
10
+ "properties": {
11
+ "url_host": {
12
+ "type": "string",
13
+ "title": "URL",
14
+ "order": 0
15
+ },
16
+ "headers": {
17
+ "type": "string",
18
+ "title": "Http Headers",
19
+ "order": 1
20
+ },
21
+ "config": {
22
+ "title": "",
23
+ "type": "object",
24
+ "properties": {
25
+ "timeout": {
26
+ "type": "integer",
27
+ "minimum": 0,
28
+ "default": 30,
29
+ "title": "Http Timeout",
30
+ "order": 0
31
+ }
32
+ },
33
+ "order": 2
34
+ }
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <svg width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none">
4
+
5
+
6
+
7
+
8
+
9
+
@@ -70,6 +70,7 @@ require_relative "integrations/source/oracle_db/client"
70
70
  require_relative "integrations/source/databrics_model/client"
71
71
  require_relative "integrations/source/aws_sagemaker_model/client"
72
72
  require_relative "integrations/source/google_vertex_model/client"
73
+ require_relative "integrations/source/http_model/client"
73
74
 
74
75
  # Destination
75
76
  require_relative "integrations/destination/klaviyo/client"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiwoven-integrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.2
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subin T P
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-11 00:00:00.000000000 Z
11
+ date: 2024-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -720,6 +720,11 @@ files:
720
720
  - lib/multiwoven/integrations/source/google_vertex_model/config/meta.json
721
721
  - lib/multiwoven/integrations/source/google_vertex_model/config/spec.json
722
722
  - lib/multiwoven/integrations/source/google_vertex_model/icon.svg
723
+ - lib/multiwoven/integrations/source/http_model/client.rb
724
+ - lib/multiwoven/integrations/source/http_model/config/catalog.json
725
+ - lib/multiwoven/integrations/source/http_model/config/meta.json
726
+ - lib/multiwoven/integrations/source/http_model/config/spec.json
727
+ - lib/multiwoven/integrations/source/http_model/icon.svg
723
728
  - lib/multiwoven/integrations/source/maria_db/client.rb
724
729
  - lib/multiwoven/integrations/source/maria_db/config/meta.json
725
730
  - lib/multiwoven/integrations/source/maria_db/config/spec.json