1
1
## Introduction ##
2
2
3
- The Predis Vector Library (PredisVL ) is a PHP client for AI applications leveraging Redis.
3
+ The Redis Vector Library (RedisVL ) is a PHP client for AI applications leveraging Redis.
4
4
5
5
Designed for:
6
6
- Vector similarity search
@@ -13,21 +13,21 @@ full-text search, and geo-spatial search.
13
13
14
14
### Installation ###
15
15
16
- For now PredisVL isn't available at packagist.org, but you can still install it via Composer by specifying [ GitHub
17
- repository] ( https://github.com/RedisVentures/predis-vl ) in your composer.json file.
16
+ For now RedisVL isn't available at packagist.org, but you can still install it via Composer by specifying [ GitHub
17
+ repository] ( https://github.com/RedisVentures/redis-vector-php ) in your composer.json file.
18
18
19
19
``` shell
20
20
{
21
21
" repositories" : [
22
22
{
23
23
" type" : " github" ,
24
- " url" : " https://github.com/RedisVentures/predis-vl .git"
24
+ " url" : " https://github.com/RedisVentures/redis-vector-php .git"
25
25
}
26
26
]
27
27
}
28
28
```
29
29
``` shell
30
- composer install redis-ventures/predis -vl
30
+ composer install redis-ventures/redis -vl
31
31
```
32
32
33
33
### Setting up Redis ####
@@ -78,7 +78,7 @@ $schema = [
78
78
2 . Create a SearchIndex object with an input schema and client connection to be able to interact with your Redis index
79
79
``` php
80
80
use Predis\Client;
81
- use RedisVentures\PredisVl \Index\SearchIndex;
81
+ use RedisVentures\RedisVl \Index\SearchIndex;
82
82
83
83
$client = new Client();
84
84
$index = new SearchIndex($client, $schema);
@@ -104,7 +104,7 @@ Define queries and perform advanced search over your indices, including combinat
104
104
105
105
** VectorQuery** - flexible vector-similarity semantic search with customizable filters
106
106
``` php
107
- use RedisVentures\PredisVl \Query\VectorQuery;
107
+ use RedisVentures\RedisVl \Query\VectorQuery;
108
108
109
109
$query = new VectorQuery(
110
110
[0.001, 0.002, 0.03],
@@ -119,8 +119,8 @@ $results = $index->query($query);
119
119
120
120
Incorporate complex metadata filters on your queries:
121
121
``` php
122
- use RedisVentures\PredisVl \Query\Filter\TagFilter;
123
- use RedisVentures\PredisVl \Enum\Condition;
122
+ use RedisVentures\RedisVl \Query\Filter\TagFilter;
123
+ use RedisVentures\RedisVl \Enum\Condition;
124
124
125
125
$filter = new TagFilter(
126
126
'categories',
@@ -150,8 +150,8 @@ Numeric filters could be applied to numeric fields.
150
150
Supports variety of conditions applicable for scalar types (==, !=, <, >, <=, >=).
151
151
More information [ here] ( https://redis.io/docs/interact/search-and-query/query/range/ ) .
152
152
``` php
153
- use RedisVentures\PredisVl \Query\Filter\NumericFilter;
154
- use RedisVentures\PredisVl \Enum\Condition;
153
+ use RedisVentures\RedisVl \Query\Filter\NumericFilter;
154
+ use RedisVentures\RedisVl \Enum\Condition;
155
155
156
156
$equal = new NumericFilter('numeric', Condition::equal, 10);
157
157
$notEqual = new NumericFilter('numeric', Condition::notEqual, 10);
@@ -167,9 +167,9 @@ Tag filters could be applied to tag fields. Single or multiple values can be pro
167
167
equality conditions (==, !==), for multiple tags additional conjunction (AND, OR) could be specified.
168
168
More information [ here] ( https://redis.io/docs/interact/search-and-query/advanced-concepts/tags/ )
169
169
``` php
170
- use RedisVentures\PredisVl \Query\Filter\TagFilter;
171
- use RedisVentures\PredisVl \Enum\Condition;
172
- use RedisVentures\PredisVl \Enum\Logical;
170
+ use RedisVentures\RedisVl \Query\Filter\TagFilter;
171
+ use RedisVentures\RedisVl \Enum\Condition;
172
+ use RedisVentures\RedisVl \Enum\Logical;
173
173
174
174
$singleTag = new TagFilter('tag', Condition::equal, 'value')
175
175
$multipleTags = new TagFilter('tag', Condition::notEqual, [
@@ -184,8 +184,8 @@ Text filters could be applied to text fields. Values can be provided as a single
184
184
specified condition. Empty value corresponds to all values (* ).
185
185
More information [ here] ( https://redis.io/docs/interact/search-and-query/query/full-text/ )
186
186
``` php
187
- use RedisVentures\PredisVl \Query\Filter\TextFilter;
188
- use RedisVentures\PredisVl \Enum\Condition;
187
+ use RedisVentures\RedisVl \Query\Filter\TextFilter;
188
+ use RedisVentures\RedisVl \Enum\Condition;
189
189
190
190
$single = new TextFilter('text', Condition::equal, 'foo');
191
191
@@ -205,9 +205,9 @@ Geo filters could be applied to geo fields. Supports only equality conditions,
205
205
value should be specified as specific-shape array.
206
206
More information [ here] ( https://redis.io/docs/interact/search-and-query/query/geo-spatial/ )
207
207
``` php
208
- use RedisVentures\PredisVl \Query\Filter\GeoFilter;
209
- use RedisVentures\PredisVl \Enum\Condition;
210
- use RedisVentures\PredisVl \Enum\Unit;
208
+ use RedisVentures\RedisVl \Query\Filter\GeoFilter;
209
+ use RedisVentures\RedisVl \Enum\Condition;
210
+ use RedisVentures\RedisVl \Enum\Unit;
211
211
212
212
$geo = new GeoFilter('geo', Condition::equal, [
213
213
'lon' => 10.111,
@@ -223,11 +223,11 @@ To apply multiple filters to a single query use AggregateFilter.
223
223
If there's the same logical operator that should be applied for each filter you can pass values in constructor,
224
224
if you need a specific combination use ` and() ` and ` or() ` methods to create combined filter.
225
225
``` php
226
- use RedisVentures\PredisVl \Query\Filter\AggregateFilter;
227
- use RedisVentures\PredisVl \Query\Filter\TextFilter;
228
- use RedisVentures\PredisVl \Query\Filter\NumericFilter;
229
- use RedisVentures\PredisVl \Enum\Condition;
230
- use RedisVentures\PredisVl \Enum\Logical;
226
+ use RedisVentures\RedisVl \Query\Filter\AggregateFilter;
227
+ use RedisVentures\RedisVl \Query\Filter\TextFilter;
228
+ use RedisVentures\RedisVl \Query\Filter\NumericFilter;
229
+ use RedisVentures\RedisVl \Enum\Condition;
230
+ use RedisVentures\RedisVl \Enum\Logical;
231
231
232
232
$aggregate = new AggregateFilter([
233
233
new TextFilter('text', Condition::equal, 'value'),
@@ -254,7 +254,7 @@ The only required option is your API key specified as environment variable or co
254
254
255
255
### OpenAI ###
256
256
``` php
257
- use RedisVentures\PredisVl \Vectorizer\Factory;
257
+ use RedisVentures\RedisVl \Vectorizer\Factory;
258
258
259
259
putenv('OPENAI_API_TOKEN=your_token');
260
260
@@ -274,7 +274,7 @@ When you perform vector queries against Redis or load hash data into index that
274
274
your vector should be represented as a blob string. VectorHelper allows you to create
275
275
blob representation from your vector represented as array of floats.
276
276
``` php
277
- use RedisVentures\PredisVl \VectorHelper;
277
+ use RedisVentures\RedisVl \VectorHelper;
278
278
279
279
$blobVector = VectorHelper::toBytes([0.001, 0.002, 0.003]);
280
280
```
0 commit comments