File tree Expand file tree Collapse file tree 5 files changed +64
-0
lines changed
pinecone-client/src/main/scala/io/cequence/pineconescala
pinecone-core/src/main/scala/io/cequence/pineconescala Expand file tree Collapse file tree 5 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ object JsonFormats {
15
15
implicit val matchFormat : Format [Match ] = Json .format[Match ]
16
16
implicit val queryResultFormat : Format [QueryResponse ] = Json .format[QueryResponse ]
17
17
implicit val fetchResponseFormat : Format [FetchResponse ] = Json .format[FetchResponse ]
18
+ implicit val vectorIdFormat : Format [VectorId ] = Json .format[VectorId ]
19
+ implicit val listVectorIdsPaginationFormat : Format [ListVectorIdsPagination ] = Json .format[ListVectorIdsPagination ]
20
+ implicit val listVectorIdsResponseFormat : Format [ListVectorIdsResponse ] = Json .format[ListVectorIdsResponse ]
21
+
18
22
19
23
// index/collection formats
20
24
implicit val collectionInfoFormat : Format [CollectionInfo ] = Json .format[CollectionInfo ]
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ object EndPoint {
9
9
case object query extends EndPoint
10
10
case object vectors_delete extends EndPoint (" vectors/delete" )
11
11
case object vectors_fetch extends EndPoint (" vectors/fetch" )
12
+ case object vectors_list extends EndPoint (" vectors/list" )
12
13
case object vectors_update extends EndPoint (" vectors/update" )
13
14
case object vectors_upsert extends EndPoint (" vectors/upsert" )
14
15
case object collections extends EndPoint
@@ -42,4 +43,7 @@ object Tag {
42
43
case object metadata_config extends Tag
43
44
case object source_collection extends Tag
44
45
case object indexName extends Tag
46
+ case object limit extends Tag
47
+ case object paginationToken extends Tag
48
+ case object prefix extends Tag
45
49
}
Original file line number Diff line number Diff line change @@ -91,6 +91,24 @@ private class PineconeVectorServiceImpl(
91
91
_.asSafe[QueryResponse ]
92
92
)
93
93
94
+ override def listVectorIDs (
95
+ namespace : String ,
96
+ limit : Option [Int ],
97
+ paginationToken : Option [String ],
98
+ prefix : Option [String ],
99
+ ): Future [ListVectorIdsResponse ] =
100
+ execGET(
101
+ EndPoint .vectors_list,
102
+ params = Seq (
103
+ Tag .namespace -> Some (namespace),
104
+ Tag .limit -> limit,
105
+ Tag .paginationToken -> paginationToken,
106
+ Tag .prefix -> prefix
107
+ )
108
+ ).map(
109
+ _.asSafe[ListVectorIdsResponse ]
110
+ )
111
+
94
112
override def delete (
95
113
ids : Seq [String ],
96
114
namespace : String
Original file line number Diff line number Diff line change
1
+ package io .cequence .pineconescala .domain .response
2
+
3
+ case class ListVectorIdsResponse (
4
+ vectors : Seq [VectorId ],
5
+ pagination : ListVectorIdsPagination ,
6
+ namespace : String
7
+ )
8
+
9
+ case class VectorId (id : String )
10
+
11
+ case class ListVectorIdsPagination (
12
+ next : Option [String ],
13
+ previous : Option [String ]
14
+ )
Original file line number Diff line number Diff line change @@ -62,6 +62,30 @@ trait PineconeVectorService extends PineconeServiceConsts {
62
62
settings : QuerySettings = DefaultSettings .Query
63
63
): Future [QueryResponse ]
64
64
65
+ /**
66
+ * The list operation lists the IDs of vectors in a single namespace.
67
+ * An optional prefix can be passed to limit the results to IDs with a common prefix.
68
+ *
69
+ * It returns up to 100 IDs at a time by default in sorted order (bitwise/"C" collation).
70
+ * If the limit parameter is set, list returns up to that number of IDs instead.
71
+ * Whenever there are additional IDs to return, the response also includes a pagination_token that you can use to get the next batch of IDs.
72
+ * When the response does not includes a pagination_token, there are no more IDs to return.
73
+ *
74
+ * @param namespace
75
+ * @param limit
76
+ * @param paginationToken
77
+ * @param prefix
78
+ *
79
+ * @return List of vector IDs wrapped in a ListVectorIdsResponse
80
+ * @see <a href="https://docs.pinecone.io/reference/list">Pinecone Doc</a>
81
+ */
82
+ def listVectorIDs (
83
+ namespace : String ,
84
+ limit : Option [Int ] = None ,
85
+ paginationToken : Option [String ] = None ,
86
+ prefix : Option [String ] = None ,
87
+ ): Future [ListVectorIdsResponse ]
88
+
65
89
/**
66
90
* The Delete operation deletes vectors, by id, from a single namespace.
67
91
*
You can’t perform that action at this time.
0 commit comments