contai 0.1.3 → 0.1.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab6215300262cdef9d61422f388d075e0323dc777158a9526244ce0038af5a6d
|
4
|
+
data.tar.gz: 9779badc8b307d7c9249f21746d6b8ee490d9dec9af08200e7a2b802fd8c82b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbe2a492e898e6e8ad8512b4998137870f081ba1a10dba1339e88006eb83caeb54c0656de42360a63fc021a3fee35e6c8a5850253bdd312128032a9ae5f900c9
|
7
|
+
data.tar.gz: 1484d66d93ad165f63270c507a2d416d8c974aa0faa8a73157aed9b6fb76de98d3260bb91cd6e1860ba107fdd03dba36ca2eea6b690b83ae89fa2dc26138ac50
|
data/lib/contai/configuration.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
module Contai
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :default_provider, :default_template, :timeout
|
3
|
+
attr_accessor :default_provider, :default_template, :timeout, :default_headers
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@default_provider = :http
|
7
7
|
@default_template = "Generate content based on: {{prompt}}"
|
8
8
|
@timeout = 30
|
9
|
+
@default_headers = { "Content-Type" => "application/json" }
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
@@ -9,9 +9,10 @@ module Contai
|
|
9
9
|
url = @options[:url] || raise(ArgumentError, "HTTP provider requires :url option")
|
10
10
|
method = (@options[:method] || :post).to_s.downcase
|
11
11
|
|
12
|
+
default_headers = Contai.configuration&.default_headers || { "Content-Type" => "application/json" }
|
12
13
|
request_options = {
|
13
|
-
headers: @options[:headers] || {
|
14
|
-
timeout: @options[:timeout] || Contai.configuration
|
14
|
+
headers: default_headers.merge(@options[:headers] || {}),
|
15
|
+
timeout: @options[:timeout] || Contai.configuration&.timeout || 30
|
15
16
|
}
|
16
17
|
|
17
18
|
body_data = @options[:body_template] || { prompt: prompt }
|
data/lib/contai/providers/n8n.rb
CHANGED
data/lib/contai/version.rb
CHANGED
@@ -7,6 +7,13 @@ Contai.configure do |config|
|
|
7
7
|
|
8
8
|
# Request timeout in seconds
|
9
9
|
config.timeout = 30
|
10
|
+
|
11
|
+
# Default headers for HTTP requests
|
12
|
+
config.default_headers = {
|
13
|
+
"Content-Type" => "application/json",
|
14
|
+
# Uncomment and set your default Authorization header if needed
|
15
|
+
# "Authorization" => "Bearer #{ENV['DEFAULT_API_KEY']}"
|
16
|
+
}
|
10
17
|
end
|
11
18
|
|
12
19
|
# Configure your AI providers here:
|