Skip to content

Commit a24de64

Browse files
author
Sam Partee
committed
Edit README
1 parent 65046a5 commit a24de64

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,27 +74,27 @@ This would correspond to a dataset that looked something like
7474
7575
With the schema, the RedisVL library can be used to create, load vectors and perform vector searches
7676
```python
77-
import pandas as pd
7877

7978
from redisvl.index import SearchIndex
80-
from redisvl.query import create_vector_query
79+
from redisvl.query import VectorQuery
8180

82-
# define and create the index
83-
index = SearchIndex.from_yaml("./users_schema.yml"))
81+
# initialize the index and connect to Redis
82+
index = SearchIndex.from_dict(schema)
8483
index.connect("redis://localhost:6379")
85-
index.create()
8684

87-
index.load(pd.read_csv("./users.csv").to_dict("records"))
85+
# create the index in Redis
86+
index.create(overwrite=True)
8887

89-
query = create_vector_query(
90-
["user", "age", "job", "credit_score"],
91-
number_of_results=2,
88+
# load data into the index in Redis (list of dicts)
89+
index.load(data)
90+
91+
query = VectorQuery(
92+
vector=[0.1, 0.1, 0.5],
9293
vector_field_name="user_embedding",
94+
return_fields=["user", "age", "job", "credit_score"],
95+
num_results=3,
9396
)
94-
95-
query_vector = np.array([0.1, 0.1, 0.5]).tobytes()
96-
results = index.search(query, query_params={"vector": query_vector})
97-
97+
results = index.search(query.query, query_params=query.params)
9898

9999
```
100100

0 commit comments

Comments
 (0)