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: 9c026d4af37a140281b3e748f4b39e9048fb5c20663e24351c01adfffa0e87d6
4
- data.tar.gz: c8566608a69e050edd6f2bbd751dae23c0a68ac898cc1c9b086b7caf7bd87d9a
3
+ metadata.gz: ab6215300262cdef9d61422f388d075e0323dc777158a9526244ce0038af5a6d
4
+ data.tar.gz: 9779badc8b307d7c9249f21746d6b8ee490d9dec9af08200e7a2b802fd8c82b1
5
5
  SHA512:
6
- metadata.gz: 9b8e0778ffa6f20ac08e39bf2b4e9d92b61401dc24c3569862ed59e2d823c714a2e288c9a8e2e49191df8ee8b8688696b77bab81ed4c225c8cff10ac1db9ff7f
7
- data.tar.gz: 4824a07aa53a719742a5af2e3698399c72757a22aefb1239e7004b045d6a53863464d3aebbcf10909d054d227f3231c86b99f8a569c2af67fcab573ca5718537
6
+ metadata.gz: dbe2a492e898e6e8ad8512b4998137870f081ba1a10dba1339e88006eb83caeb54c0656de42360a63fc021a3fee35e6c8a5850253bdd312128032a9ae5f900c9
7
+ data.tar.gz: 1484d66d93ad165f63270c507a2d416d8c974aa0faa8a73157aed9b6fb76de98d3260bb91cd6e1860ba107fdd03dba36ca2eea6b690b83ae89fa2dc26138ac50
@@ -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] || { "Content-Type" => "application/json" },
14
- timeout: @options[:timeout] || Contai.configuration.timeout
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 }
@@ -7,7 +7,6 @@ module Contai
7
7
  super({
8
8
  url: webhook_url,
9
9
  method: :post,
10
- headers: { "Content-Type" => "application/json" },
11
10
  body_template: { prompt: "{{prompt}}" },
12
11
  response_path: options[:response_path] || "output"
13
12
  }.merge(options))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Contai
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.5"
5
5
  end
@@ -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:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Panasenkov A.