pinecone 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pinecone/vector/filter.rb +1 -1
- data/lib/pinecone/vector/query.rb +1 -1
- data/lib/pinecone/vector/sparse_vector.rb +1 -1
- data/lib/pinecone/vector.rb +52 -1
- data/lib/pinecone/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9e5f89bdb821f056dde85c82168420d575599d116508b083fb987ea7b3b60da
|
4
|
+
data.tar.gz: b4d1da67d606505ca251db63cc63a9077d363e92425ddfeb4ea55263af30aac6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c429ec85b521a797a73597a6cba93b77e4892e84176064079367605c8436b15709aa03fd7ab563240c96bc8406c6b805c3d43bb7cc7f91c8c7ad1b016724acfe
|
7
|
+
data.tar.gz: 749c157e0650086c2365023cf8a9626ef04fd4bce9b5eac886de5007480c64318aa0c3312ea1795713ca08475c5e2f5396130aaabe2bb84d5d853d52969c12d1
|
data/lib/pinecone/vector.rb
CHANGED
@@ -26,7 +26,6 @@ module Pinecone
|
|
26
26
|
deleteAll: delete_all,
|
27
27
|
filter: filter
|
28
28
|
}
|
29
|
-
|
30
29
|
inputs.delete(:filter) if delete_all || ids.any?
|
31
30
|
payload = options.merge(body: inputs.to_json)
|
32
31
|
self.class.post("#{@base_uri}/vectors/delete", payload)
|
@@ -37,6 +36,58 @@ module Pinecone
|
|
37
36
|
self.class.get("#{@base_uri}/vectors/fetch?#{query_string}", options)
|
38
37
|
end
|
39
38
|
|
39
|
+
def list(prefix: nil, limit: nil, namespace: nil, &block)
|
40
|
+
all_ids = []
|
41
|
+
pagination_token = nil
|
42
|
+
total_fetched = 0
|
43
|
+
|
44
|
+
loop do
|
45
|
+
current_limit = limit.nil? ? 100 : [limit - total_fetched, 100].min
|
46
|
+
|
47
|
+
response = list_paginated(
|
48
|
+
prefix: prefix,
|
49
|
+
limit: current_limit,
|
50
|
+
pagination_token: pagination_token,
|
51
|
+
namespace: namespace
|
52
|
+
)
|
53
|
+
|
54
|
+
break unless response.success?
|
55
|
+
|
56
|
+
results = response.parsed_response
|
57
|
+
ids = results["vectors"]&.map { |v| v["id"] } || []
|
58
|
+
|
59
|
+
if block
|
60
|
+
yield ids
|
61
|
+
else
|
62
|
+
all_ids.concat(ids)
|
63
|
+
end
|
64
|
+
|
65
|
+
total_fetched += ids.length
|
66
|
+
pagination_token = results.dig("pagination", "next")
|
67
|
+
|
68
|
+
break if ids.empty?
|
69
|
+
break if limit && total_fetched >= limit
|
70
|
+
break if pagination_token.nil? || pagination_token.empty?
|
71
|
+
end
|
72
|
+
|
73
|
+
if block
|
74
|
+
nil
|
75
|
+
else
|
76
|
+
limit ? all_ids.first(limit) : all_ids
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def list_paginated(prefix: nil, limit: nil, pagination_token: nil, namespace: nil)
|
81
|
+
query_params = {}
|
82
|
+
query_params["prefix"] = prefix if prefix
|
83
|
+
query_params["limit"] = limit if limit
|
84
|
+
query_params["paginationToken"] = pagination_token if pagination_token
|
85
|
+
query_params["namespace"] = namespace if namespace
|
86
|
+
|
87
|
+
query_string = URI.encode_www_form(query_params)
|
88
|
+
self.class.get("#{@base_uri}/vectors/list?#{query_string}", options)
|
89
|
+
end
|
90
|
+
|
40
91
|
def upsert(body)
|
41
92
|
payload = options.merge(body: body.to_json)
|
42
93
|
self.class.post("#{@base_uri}/vectors/upsert", payload)
|
data/lib/pinecone/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pinecone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Carleton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.22.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.22.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dry-struct
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,14 +82,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
82
|
requirements:
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
85
|
+
version: '3'
|
86
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
|
-
rubygems_version: 3.
|
92
|
+
rubygems_version: 3.5.15
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: Ruby client library for Pinecone Vector DB
|