weaviate-ruby 0.7.1 → 0.7.2
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/Gemfile.lock +1 -1
- data/README.md +6 -5
- data/lib/weaviate/client.rb +26 -2
- data/lib/weaviate/query.rb +8 -0
- data/lib/weaviate/version.rb +1 -1
- data/lib/weaviate.rb +1 -0
- 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: f1944f940c8677b6293af834af96e6b2c3635475703bffb96a123bfc7e164a4d
         | 
| 4 | 
            +
              data.tar.gz: c4b719e54d31ae823054bd40d1a450efd7c5d7738bca23fb8187366ee4e9e140
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4e81d9d0960153df197c746b120408f74a08da2c6336665e73756243e6ba2d84354b8ef6770998cae8d0411904a988fa0ec82f2ccba1d69ec4da6765b2da65c8
         | 
| 7 | 
            +
              data.tar.gz: 62751834232ad87ef75aa115c55781dd9d9aec47ecddea7c9b21a035c91ebf8824dad0a506c7c8d44fa56ac8f16bb2f5295f5b7fdebf198ab5dc6c6d480392dd
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -8,7 +8,7 @@ | |
| 8 8 |  | 
| 9 9 | 
             
            Ruby wrapper for the Weaviate.io API
         | 
| 10 10 |  | 
| 11 | 
            -
            
         | 
| 11 | 
            +
             [](https://badge.fury.io/rb/weaviate-ruby)
         | 
| 12 12 |  | 
| 13 13 | 
             
            ## Installation
         | 
| 14 14 |  | 
| @@ -172,6 +172,7 @@ client.objects.batch_delete( | |
| 172 172 | 
             
            near_text = '{ concepts: ["biology"] }'
         | 
| 173 173 | 
             
            sort_obj = '{ path: ["category"], order: desc }'
         | 
| 174 174 | 
             
            where_obj = '{ path: ["id"], operator: Equal, valueString: "..." }'
         | 
| 175 | 
            +
            with_hybrid = '{ query: "Sweets", alpha: 0.5 }'
         | 
| 175 176 |  | 
| 176 177 | 
             
            client.query.get(
         | 
| 177 178 | 
             
                class_name: 'Question',
         | 
| @@ -187,13 +188,13 @@ client.query.get( | |
| 187 188 | 
             
                near_text: near_text,
         | 
| 188 189 |  | 
| 189 190 | 
             
                # To use this parameter you must have created your schema by setting the `vectorizer:` property to 'multi2vec-clip' or 'img2vec-neural'
         | 
| 190 | 
            -
                 | 
| 191 | 
            +
                near_image: near_image,
         | 
| 191 192 |  | 
| 192 | 
            -
                 | 
| 193 | 
            +
                with_hybrid: with_hybrid,
         | 
| 193 194 |  | 
| 194 | 
            -
                 | 
| 195 | 
            +
                bm25: bm25,
         | 
| 195 196 |  | 
| 196 | 
            -
                 | 
| 197 | 
            +
                near_object: near_object,
         | 
| 197 198 |  | 
| 198 199 | 
             
                ask: '{ question: "your-question?" }'
         | 
| 199 200 | 
             
            )
         | 
    
        data/lib/weaviate/client.rb
    CHANGED
    
    | @@ -5,7 +5,8 @@ require "graphlient" | |
| 5 5 |  | 
| 6 6 | 
             
            module Weaviate
         | 
| 7 7 | 
             
              class Client
         | 
| 8 | 
            -
                attr_reader :scheme, :host, :api_key, :model_service, :model_service_api_key, :adapter
         | 
| 8 | 
            +
                attr_reader :scheme, :host, :api_key, :model_service, :model_service_api_key, :adapter,
         | 
| 9 | 
            +
                  :username, :password
         | 
| 9 10 |  | 
| 10 11 | 
             
                API_VERSION = "v1"
         | 
| 11 12 |  | 
| @@ -21,7 +22,9 @@ module Weaviate | |
| 21 22 | 
             
                  api_key: nil,
         | 
| 22 23 | 
             
                  model_service: nil,
         | 
| 23 24 | 
             
                  model_service_api_key: nil,
         | 
| 24 | 
            -
                  adapter: Faraday.default_adapter
         | 
| 25 | 
            +
                  adapter: Faraday.default_adapter,
         | 
| 26 | 
            +
                  username: nil,
         | 
| 27 | 
            +
                  password: nil
         | 
| 25 28 | 
             
                )
         | 
| 26 29 | 
             
                  validate_model_service!(model_service) unless model_service.nil?
         | 
| 27 30 |  | 
| @@ -31,6 +34,8 @@ module Weaviate | |
| 31 34 | 
             
                  @model_service = model_service
         | 
| 32 35 | 
             
                  @model_service_api_key = model_service_api_key
         | 
| 33 36 | 
             
                  @adapter = adapter
         | 
| 37 | 
            +
                  @username = username
         | 
| 38 | 
            +
                  @password = password
         | 
| 34 39 | 
             
                end
         | 
| 35 40 |  | 
| 36 41 | 
             
                def oidc
         | 
| @@ -77,6 +82,10 @@ module Weaviate | |
| 77 82 | 
             
                  @query ||= Weaviate::Query.new(client: self)
         | 
| 78 83 | 
             
                end
         | 
| 79 84 |  | 
| 85 | 
            +
                def clusters
         | 
| 86 | 
            +
                  @clusters ||= Weaviate::Clusters.new(client: self)
         | 
| 87 | 
            +
                end
         | 
| 88 | 
            +
             | 
| 80 89 | 
             
                def graphql
         | 
| 81 90 | 
             
                  headers = {}
         | 
| 82 91 |  | 
| @@ -98,6 +107,21 @@ module Weaviate | |
| 98 107 | 
             
                  )
         | 
| 99 108 | 
             
                end
         | 
| 100 109 |  | 
| 110 | 
            +
                def wsc
         | 
| 111 | 
            +
                  @wsc ||= Faraday.new(url: "https://wcs.api.semi.technology/v1") do |faraday|
         | 
| 112 | 
            +
                    # if api_key
         | 
| 113 | 
            +
                    #   faraday.request :authorization, :Bearer, api_key
         | 
| 114 | 
            +
                    if password && username
         | 
| 115 | 
            +
                    #   faraday.request :authorization, :Basic, Base64.encode64("#{username}:#{password}")
         | 
| 116 | 
            +
                    end
         | 
| 117 | 
            +
             | 
| 118 | 
            +
             | 
| 119 | 
            +
                    faraday.request :json
         | 
| 120 | 
            +
                    faraday.response :json, content_type: /\bjson$/
         | 
| 121 | 
            +
                    faraday.adapter adapter
         | 
| 122 | 
            +
                  end
         | 
| 123 | 
            +
                end
         | 
| 124 | 
            +
             | 
| 101 125 | 
             
                def connection
         | 
| 102 126 | 
             
                  @connection ||= Faraday.new(url: "#{scheme}://#{host}/#{API_VERSION}/") do |faraday|
         | 
| 103 127 | 
             
                    if api_key
         | 
    
        data/lib/weaviate/query.rb
    CHANGED
    
    | @@ -13,6 +13,8 @@ module Weaviate | |
| 13 13 | 
             
                  near_text: nil,
         | 
| 14 14 | 
             
                  near_vector: nil,
         | 
| 15 15 | 
             
                  near_object: nil,
         | 
| 16 | 
            +
                  with_hybrid: nil,
         | 
| 17 | 
            +
                  bm25: nil,
         | 
| 16 18 | 
             
                  ask: nil
         | 
| 17 19 | 
             
                )
         | 
| 18 20 | 
             
                  response = client.graphql.execute(
         | 
| @@ -24,6 +26,8 @@ module Weaviate | |
| 24 26 | 
             
                      near_text: near_text,
         | 
| 25 27 | 
             
                      near_vector: near_vector,
         | 
| 26 28 | 
             
                      near_object: near_object,
         | 
| 29 | 
            +
                      with_hybrid: with_hybrid,
         | 
| 30 | 
            +
                      bm25: bm25,
         | 
| 27 31 | 
             
                      ask: ask
         | 
| 28 32 | 
             
                    ),
         | 
| 29 33 | 
             
                    after: after,
         | 
| @@ -124,6 +128,8 @@ module Weaviate | |
| 124 128 | 
             
                  near_text: nil,
         | 
| 125 129 | 
             
                  near_vector: nil,
         | 
| 126 130 | 
             
                  near_object: nil,
         | 
| 131 | 
            +
                  with_hybrid: nil,
         | 
| 132 | 
            +
                  bm25: nil,
         | 
| 127 133 | 
             
                  ask: nil,
         | 
| 128 134 | 
             
                  sort: nil
         | 
| 129 135 | 
             
                )
         | 
| @@ -141,6 +147,8 @@ module Weaviate | |
| 141 147 | 
             
                          #{near_text.present? ? "nearText: #{near_text}" : ""},
         | 
| 142 148 | 
             
                          #{near_vector.present? ? "nearVector: #{near_vector}" : ""},
         | 
| 143 149 | 
             
                          #{near_object.present? ? "nearObject: #{near_object}" : ""},
         | 
| 150 | 
            +
                          #{with_hybrid.present? ? "hybrid: #{with_hybrid}" : ""},
         | 
| 151 | 
            +
                          #{bm25.present? ? "bm25: #{bm25}" : ""},
         | 
| 144 152 | 
             
                          #{ask.present? ? "ask: #{ask}" : ""},
         | 
| 145 153 | 
             
                          #{where.present? ? "where: #{where}" : ""},
         | 
| 146 154 | 
             
                          #{sort.present? ? "sort: #{sort}" : ""}
         | 
    
        data/lib/weaviate/version.rb
    CHANGED
    
    
    
        data/lib/weaviate.rb
    CHANGED
    
    | @@ -5,6 +5,7 @@ require_relative "weaviate/version" | |
| 5 5 | 
             
            module Weaviate
         | 
| 6 6 | 
             
              autoload :Base, "weaviate/base"
         | 
| 7 7 | 
             
              autoload :Client, "weaviate/client"
         | 
| 8 | 
            +
              autoload :Clusters, "weaviate/clusters"
         | 
| 8 9 | 
             
              autoload :Error, "weaviate/error"
         | 
| 9 10 | 
             
              autoload :Schema, "weaviate/schema"
         | 
| 10 11 | 
             
              autoload :Meta, "weaviate/meta"
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: weaviate-ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.7. | 
| 4 | 
            +
              version: 0.7.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Andrei Bondarev
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023-04- | 
| 11 | 
            +
            date: 2023-04-13 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: faraday
         |