Skip to content

Commit 48e6af3

Browse files
DOC-4837 added imports
1 parent 1c12921 commit 48e6af3

File tree

1 file changed

+42
-12
lines changed

1 file changed

+42
-12
lines changed

content/develop/clients/jedis/vecsearch.md

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,56 @@ Redis Query Engine.
3535

3636
## Initialize
3737

38-
Install [`redis-py`]({{< relref "/develop/clients/redis-py" >}}) if you
39-
have not already done so. Also, install `sentence-transformers` with the
40-
following command:
38+
Install [`jedis`]({{< relref "/develop/clients/jedis" >}}) if you
39+
have not already done so.
40+
41+
If you are using [Maven](https://maven.apache.org/), add the following
42+
dependencies to your `pom.xml` file:
43+
44+
```xml
45+
<dependency>
46+
<groupId>redis.clients</groupId>
47+
<artifactId>jedis</artifactId>
48+
<version>5.2.0</version>
49+
</dependency>
50+
<dependency>
51+
<groupId>ai.djl.huggingface</groupId>
52+
<artifactId>tokenizers</artifactId>
53+
<version>0.24.0</version>
54+
</dependency>
55+
```
56+
57+
If you are using [Gradle](https://gradle.org/), add the following
58+
dependencies to your `build.gradle` file:
4159

4260
```bash
43-
pip install sentence-transformers
61+
implementation 'redis.clients:jedis:5.2.0'
62+
implementation 'ai.djl.huggingface:tokenizers:0.24.0'
4463
```
4564

46-
In a new Python source file, start by importing the required classes:
65+
## Import dependencies
4766

48-
```python
49-
from sentence_transformers import SentenceTransformer
50-
from redis.commands.search.query import Query
51-
from redis.commands.search.field import TextField, TagField, VectorField
52-
from redis.commands.search.indexDefinition import IndexDefinition, IndexType
67+
Import the following classes in your source file:
5368

54-
import numpy as np
55-
import redis
69+
```java
70+
// Jedis client and query engine classes.
71+
import redis.clients.jedis.UnifiedJedis;
72+
import redis.clients.jedis.search.*;
73+
import redis.clients.jedis.search.schemafields.*;
74+
import redis.clients.jedis.search.schemafields.VectorField.VectorAlgorithm;
75+
import redis.clients.jedis.exceptions.JedisDataException;
76+
77+
// Data manipulation.
78+
import java.nio.ByteBuffer;
79+
import java.nio.ByteOrder;
80+
import java.util.Map;
81+
import java.util.List;
82+
83+
// Tokenizer to generate the vector embeddings.
84+
import ai.djl.huggingface.tokenizers.HuggingFaceTokenizer;
5685
```
5786

87+
5888
The first of these imports is the
5989
`SentenceTransformer` class, which generates an embedding from a section of text.
6090
Here, we create an instance of `SentenceTransformer` that uses the

0 commit comments

Comments
 (0)