omniai 2.3.0 → 2.4.0

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: c51b267abaf795fb5fcef9ec71af335e1ac5ecb70339781692e70f6956eddbb2
4
- data.tar.gz: aa06c0f668458bce2bbf396c3e512179950b6916b601b1df8d90b1766726f154
3
+ metadata.gz: 8b888dff5046dce34b72c4e1e37cad2ed2ce0a9a5259b1a998cc85567dc3f202
4
+ data.tar.gz: 14d100fd069b47cc0cd6a40794a0582639baf07384050d0e47a574a0062e01b9
5
5
  SHA512:
6
- metadata.gz: abb95079f33a91d0fa842e8f6ec6980cadbee8669f8aa2ead86f9413ccc2f7edf760f22adee9c7b24d94bd8b1b10f985fa247c310a23f8519f8c19de73c3d775
7
- data.tar.gz: e3307314435c7fa559fca55266c1ca9155ed9c7fef9bc0dee16443ba1fe7b056771ec7e49fc461f2504ef0ee443a6fd7c2975b5433a0b308fc694bf80f6c7908
6
+ metadata.gz: 3a11e8b75566c699dd7f3c5bf2ae97a004bfb4ff0479e671dd7665db09970627666cacca21d72d11016ab4b783256e96799d66ea65f063492531a5a0320c025a
7
+ data.tar.gz: cc7e0e511676995ce72b092fd9238ba507f78bb371bc2eb6c1cff0d76ac27c3c28672f1ccd66da4360c4ff1294b6732301744bb4db06c97d51ac65580401dd60
@@ -9,7 +9,7 @@ module OmniAI
9
9
  attr_accessor :io
10
10
 
11
11
  # @param io [IO, Pathname, String]
12
- # @param type [Symbol, String] :image, :video, :audio, "audio/flac", "image/jpeg", "video/mpeg", etc.
12
+ # @param type [Symbol, String] "audio/flac", "image/jpeg", "video/mpeg", :audio, :image, :video, :document, etc.
13
13
  def initialize(io, type)
14
14
  super(type)
15
15
  @io = io
@@ -9,7 +9,7 @@ module OmniAI
9
9
  # @return [Symbol, String]
10
10
  attr_accessor :type
11
11
 
12
- # @param type [String] "audio/flac", "image/jpeg", "video/mpeg", etc.
12
+ # @param type [String] "audio/flac", "image/jpeg", "video/mpeg", "application/pdf", etc.
13
13
  def initialize(type)
14
14
  super()
15
15
  @type = type
@@ -40,12 +40,18 @@ module OmniAI
40
40
  @type.match?(%r{^video/})
41
41
  end
42
42
 
43
- # @return [:video, :audio, :image, :text]
43
+ # @return [Boolean]
44
+ def document?
45
+ @type.match?(%r{^application/pdf$})
46
+ end
47
+
48
+ # @return [:text, :audio, :image, :video :document]
44
49
  def kind
45
50
  if text? then :text
46
51
  elsif audio? then :audio
47
52
  elsif image? then :image
48
53
  elsif video? then :video
54
+ elsif document? then :document
49
55
  else
50
56
  raise(TypeError, "unsupported type=#{@type}")
51
57
  end
@@ -10,7 +10,7 @@ module OmniAI
10
10
  class FetchError < HTTPError; end
11
11
 
12
12
  # @param uri [URI, String] "https://example.com/cat.jpg"
13
- # @param type [Symbol, String] "audio/flac", "image/jpeg", "video/mpeg", :audi, :image, :video, etc.
13
+ # @param type [Symbol, String] "audio/flac", "image/jpeg", "video/mpeg", :audio, :image, :video, :document, etc.
14
14
  def initialize(uri, type = nil)
15
15
  super(type)
16
16
  @uri = uri
data/lib/omniai/chat.rb CHANGED
@@ -114,7 +114,7 @@ module OmniAI
114
114
  !@stream.nil?
115
115
  end
116
116
 
117
- # Override to provide an context for serializers / deserializes for a provider.
117
+ # Override to provide a context (serializers / deserializes) for a provider.
118
118
  #
119
119
  # @return [Context, nil]
120
120
  def context
data/lib/omniai/embed.rb CHANGED
@@ -53,10 +53,17 @@ module OmniAI
53
53
 
54
54
  protected
55
55
 
56
+ # Override to provide a context (serializers / deserializes) for a provider.
57
+ #
58
+ # @return [Context, nil]
59
+ def context
60
+ nil
61
+ end
62
+
56
63
  # @param response [HTTP::Response]
57
64
  # @return [Response]
58
65
  def parse!(response:)
59
- Response.new(data: response.parse)
66
+ Response.new(data: response.parse, context:)
60
67
  end
61
68
 
62
69
  # @return [HTTP::Response]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OmniAI
4
- VERSION = "2.3.0"
4
+ VERSION = "2.4.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniai
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-04-03 00:00:00.000000000 Z
10
+ date: 2025-04-08 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: event_stream_parser