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 +4 -4
- data/lib/omniai/chat/file.rb +1 -1
- data/lib/omniai/chat/media.rb +8 -2
- data/lib/omniai/chat/url.rb +1 -1
- data/lib/omniai/chat.rb +1 -1
- data/lib/omniai/embed.rb +8 -1
- data/lib/omniai/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8b888dff5046dce34b72c4e1e37cad2ed2ce0a9a5259b1a998cc85567dc3f202
         | 
| 4 | 
            +
              data.tar.gz: 14d100fd069b47cc0cd6a40794a0582639baf07384050d0e47a574a0062e01b9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3a11e8b75566c699dd7f3c5bf2ae97a004bfb4ff0479e671dd7665db09970627666cacca21d72d11016ab4b783256e96799d66ea65f063492531a5a0320c025a
         | 
| 7 | 
            +
              data.tar.gz: cc7e0e511676995ce72b092fd9238ba507f78bb371bc2eb6c1cff0d76ac27c3c28672f1ccd66da4360c4ff1294b6732301744bb4db06c97d51ac65580401dd60
         | 
    
        data/lib/omniai/chat/file.rb
    CHANGED
    
    | @@ -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]  | 
| 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
         | 
    
        data/lib/omniai/chat/media.rb
    CHANGED
    
    | @@ -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 [ | 
| 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
         | 
    
        data/lib/omniai/chat/url.rb
    CHANGED
    
    | @@ -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", : | 
| 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  | 
| 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]
         | 
    
        data/lib/omniai/version.rb
    CHANGED
    
    
    
        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. | 
| 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- | 
| 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
         |